Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want to block the packets whose source ip is not localhost(172.17.7.1) when sending out. how to do this ? I write a rule like this
iptables -A OUTPUT -s !172.17.7.1 -J DROP
it does not work`
iptables -A OUTPUT -s ! 172.17.7.1 -j DROP
Use small caps "j" and append space after "!" sign, else it will be interpreted like a command from your shell history.
Pay attention that you do apppend with A and not insert on the beginning of the chain.
Required, but never shown