Suppose I already have rules for iptables like this:
$ iptables -L FORWARD -n -v --line-numbers Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 228 13794 ACCEPT all -- vmbr0 ppp0 192.168.1.10 0.0.0.0/0 2 337 28308 DROP all -- vmbr0 ppp0 0.0.0.0/0 0.0.0.0/0I want to insert my new rule between them (number 1 and 2). Here's how to do it:
$ iptables -I FORWARD 2 -i vmbr0 -o ppp0 -s 192.168.1.11 -j ACCEPTiptables insertion rules sounds something like "Insert it before number {X}". So in my case I need to put it before number 2 (-I FORWARD 2). Take a look to the result.
$ iptables -L FORWARD -n -v --line-numbers Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 228 13794 ACCEPT all -- vmbr0 ppp0 192.168.1.10 0.0.0.0/0 2 0 0 ACCEPT all -- vmbr0 ppp0 192.168.1.11 0.0.0.0/0 3 342 28728 DROP all -- vmbr0 ppp0 0.0.0.0/0 0.0.0.0/0
0 comments:
Post a Comment