I have a dedicated server with an LXC container on it. The container has IP: 11.22.33.44.
I want to block outgoing port 25 of this container, so that the container cannot send out email.
From the host machine (Ubuntu 16.04), i use the following commands:
iptables -A FORWARD -p tcp --dport 25 -s 11.22.33.44 -j DROP
iptables -A OUTPUT -p tcp --dport 25 -s 11.22.33.44 -j DROP
However, from inside the container, i still can telnet to port 25 of another server
bash-4.1# telnet mysite.com 25
Trying 64.14.157.215...
Connected to mysite.com.
Escape character is '^]'.
220 phoenix.mysite.com ESMTP Postfix (Ubuntu)
Previously, i used debian 8 as the OS for my host machine, and it work great, but in ubuntu 16.04, i may miss some important steps to make it work.
Could anyone help me point out what is wrong here?
Thank you!
iptablesis used for incoming connections, once you've stopped the mail server on the "host server",telnetis used for outgoing connections. Or I don't understand the question. – waltinator Sep 25 '16 at 15:32