2
I have a server (Ubuntu) with two public IPs: the first one is dynamic and the second static.
Software run on the server connects to a public internet endpoint which is behind a firewall for whitelisting IPs, hence it needs to use the static IP for outbound traffic there for things to work.
The server is configured so the static IP is on a loopback interface and set up to
$ sudo vim /etc/network/interfaces.d/eip.cfg
auto lo:1
iface lo:1 inet static
address <static_ip>/32
post-up ip route replace default via <dynamic_ip> src <static_ip>
After network restart, it's possible to see the static IP like so:
$ curl ipinfo.io/ip
<static_ip>
Hence, all works well and it's possible to curl the other endpoint. All good.
PROBLEM
The software uses Docker and thus sits inside a container that even uses a custom network.
I have already tested to use --network=host
and that works well because this puts the container on the host's network (where it's working).
The issue is that the container must be on the custom network, because it connects to other internal services on that network.
I understand that Docker uses MASQUERADE and that it could be possible to switch that off and configure iptables manually as an option. However, I wonder what other options are available and what is the option that could be recommended.
I'm open for suggestions - maybe someone has done this already! Thanks!
https://serverfault.com/q/686035/125521 – Matt – 2018-01-09T09:32:01.217