docker container as gateway between two docker bridges -


i trying simulate production network docker.

i have 2 docker bridges, bridge1 , bridge2.

i want put docker container router gateway between them.

not sure following commands, want this:

router: (172.17.0.2) iptables --table nat --append postrouting --out-interface eth0 -j masquerade iptables -i forward -s 192.168.9.0/24 -d 192.168.8.0/24 -j accept iptables -i forward -s 192.168.8.0/24 -d 192.168.9.0/24 -j accept 

bridge1: ip route add 192.168.9.0/24 via 172.17.0.2 dev eth0 

bridge2: ip route add 192.168.8.0/24 via 172.17.0.2 dev eth0 

are above commands correct? how can add iptables rules, how cannot change them.

you need --cap-add=net_admin able run iptables command in docker containers.

read: https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -