Bootstrap FreeKB - iptables - Allow or deny a connection on an interface
iptables - Allow or deny a connection on an interface

Updated:   |  iptables articles

When adding, appending, updating or deleting a rule from iptables, the following options can be used to allow or deny an incoming or outgoing connection on the inteface.

In this example, the -o or --out-inteface option is used to allow outbound connections on TCP port 80 on the eth0 interface.

iptables --append INPUT --out-inteface eth0 --protocol tcp --dport 80 --jump ACCEPT

 

In this example, the ! (exclamation point) is used to deny outbound connections on TCP port 80 on the eth0 interface.

iptables --append INPUT ! --out-inteface eth0 --protocol tcp --dport 80 --jump ACCEPT

 

In this example, the -i or --in-inteface option is used to allow inbound connections on TCP port 80 on the eth0 interface.

iptables --append INPUT --in-inteface eth0 --protocol tcp --dport 80 --jump ACCEPT

 

In this example, the ! (exclamation point) is used to deny inbound connections on TCP port 80 on the eth0 interface.

iptables --append INPUT ! --in-inteface eth0 --protocol tcp --dport 80 --jump ACCEPT



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 235f93 in the box below so that we can be sure you are a human.