You must to configure ip static in your server. Open with nano or other text edit / etc / network / interfaces and add this lines to configure
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
Later enter in your router, depending the router brand, you must to search NAT seccion, Virtual Server or Port Forwarding, configure these options:
-name service: name of the application the service will use
-protocol: UDP, TCP or BOTH
-extern port: the port where you connect with other network
-internal port: some routers allow us to forward internal ports, that is, if we only fill in the external port, the internal port will be exactly the same, but we can change this, for this reason, this is optional.
-Intern IP : your Ubuntu IP you configure in /etc/network/interfaces
-Origin IP: in some routers you can configure the source IP only to allow access to this IP, for security, if you don't have the option on your router, configure on your server with iptables. If you don't configure this, anyone can connect to your server.
Now you can connect with your server with your router IP and the port you configured