A robot is connected to a network with restricted outbound traffic. Only inbound traffic is allowed from one specific IP address(ours IP, e.g. 111.111.111.111). All outgoing traffic is forbidden.
There is settings and dhcp corresponding to external IP(e.g. 222.222.222.222). We want to connect to Pepper from the IP 111.111.111.111. The connection through SSH is fine with ssh nao@222.222.222.222 and password but we can not connect through Choregraphe or Python scripts. This is very important because we want to be able to connect with the robot remotely to upload different Choregraphe applications.
This is the error when we are trying to connect with a Python script:

[W] 18872 qimessaging.transportsocket: connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
...
RuntimeError: Failed to connect to service ALBehaviorManager on machine 1296211e-1921-3131-909b-69afa37ааа28. All endpoints are unavailable.

The Choregraphe hangs and crashes after a certain period of time.
Can you give me some advice?
NAOqi connections go through port 9559 by default, so you could check whether that one is blocked.
If you are unable to connect through port 9559, you can do a port forwarding.  But I think this is a more network related question.
How to connect Choregraphe/Python script to remote Pepper robot from different network?