I would like to create a network which gives containers their own IP from my subnet. The IP is routed through the main ip for my server.
Currently I created a bridge with the subnet, using one of the IPs in the subnet as the gateway. This works and containers are able to connect to the internet, traffic is routed into the container correctly. However, although traffic is routed IN to the container correctly, traffic coming out appears to come from the host.
Host IP: 88 .99 .11 .22
Container IP: 88 .99 .123 .22
a http get request to 88 .99 .123. 22 will work, it will be routed into the container and if the container is running a web server, the page is returned.
however, if a container makes a post request, then the receiving server sees the request as if it came from 88. 99. 11 .22
This has not been an issue for a while, however I just set up a mail server inside of the docker, I setup the reverse dns for 88 .99 .123 .22 to point to mail .mydomain .com however, when emails are sent, the reverse dns lookup fails because as far as the receiving mail servers are concerned, the mail was sent from 88 .99. 11 .22.
Out of curiosity I wiped the server, installed windows and followed the Hyper-V guide from Hetzner (my server host) to make sure that VMs do actually get their own IP, this was the case. When I was using hyper-v and went to some site like whatsmyip .com it would return 88 .99. 123. 22 which is correct.
This is how the host advices me to setup hyper-v: https://docs.hetzner.com/robot/dedicated-server/windows-server/windows-server-subnet
How can I replicate this in docker so I can have each container have its own ip and have the containers access the web from that ip.
I have been trying to do this for weeks and have gotten no where