mysql iptable
發表於 : 2017-08-27 20:47:04
https://serverfault.com/questions/70464 ... h-iptables
The answer seems to be in Docker's documentation at https://docs.docker.com/articles/networking/#the-world
Docker’s forward rules permit all external source IPs by default. To allow only a specific IP or network to access the containers, insert a negated rule at the top of the DOCKER filter chain. For example, to restrict external access such that only source IP 8.8.8.8 can access the containers, the following rule could be added: iptables -I DOCKER -i ext_if ! -s 8.8.8.8 -j DROP
What I ended up doing was:
I didn't touch the --iptables or --icc options.
The answer seems to be in Docker's documentation at https://docs.docker.com/articles/networking/#the-world
Docker’s forward rules permit all external source IPs by default. To allow only a specific IP or network to access the containers, insert a negated rule at the top of the DOCKER filter chain. For example, to restrict external access such that only source IP 8.8.8.8 can access the containers, the following rule could be added: iptables -I DOCKER -i ext_if ! -s 8.8.8.8 -j DROP
What I ended up doing was:
代碼: 選擇全部
iptables -I DOCKER -i eth0 -s 8.8.8.8 -p tcp --dport 3306 -j ACCEPT
iptables -I DOCKER -i eth0 -s 4.4.4.4 -p tcp --dport 3306 -j ACCEPT
iptables -I DOCKER 3 -i eth0 -p tcp --dport 3306 -j DROP