Q:

Question with Iptable rules

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`

A:

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. 

