We are currently hosting docker on an AWS EC2 but have run into a bit of network issue. We have multiple containers connected to a docker network bridge called NetBrig. I want to forward all traffic coming in on different AWS IPs across multiple network interfaces to private IPs on the network bridge like so
- (AWS ELastic IP) --> 172.31.7.45 --> eth0 --> 172.20.0.11
- (AWS ELastic IP) --> 172.31.7.46 --> eth0 --> 172.20.0.12
- (AWS ELastic IP) --> 172.31.7.50 --> eth1 --> 172.20.0.13
- (AWS ELastic IP) --> 172.31.7.51 --> eth1 --> 172.20.0.14
I am currently have no issues using DNAT rules below for the private IPs on eth0:
sudo iptables -I FORWARD -j ACCEPT
sudo iptables -t nat -A PREROUTING -d 172.31.7.45 -j DNAT --to-destination 172.20.0.11
sudo iptables -t nat -A PREROUTING -d 172.31.7.46 -j DNAT --to-destination 172.20.0.12
sudo iptables -t nat -A PREROUTING -d 172.31.7.50 -j DNAT --to-destination 172.20.0.13
sudo iptables -t nat -A PREROUTING -d 172.31.7.51 -j DNAT --to-destination 172.20.0.14
But the DNAT rules above do not seem to work for the private IPs across eth1. All my requests appear to time out. Does anyone have any suggestions?