Simon Woodside | Simon Says | IPTables unix/linux firewall, simple commands
Skip to content >

Simon Says : IPTables unix/linux firewall, simple commands

A weblog by Simon Woodside

# posted 2007/04/02 in dev/unix (+2). save to bookmark on del.icio.us, bookmark on digg

IPTables unix/linux firewall, simple commands

Since all the iptables documentation out there is super complicated, here's something really simple.

To see all of the ports that are open, run:


       sudo iptables --list
      

To add a new rule (to open a new port, e.g. 8080):


       sudo iptables -A tcp_in -p tcp -d my.hostname.com --destination-port 8080 -j allowed
      

That's assuming you have a chain called "tcp_in" of course...

And to delete a rule, run iptables --list, count the number of the rule (the index #) and then:


       sudo iptables -D tcp_in [index]
      

Simple enough....

Copyright © 1996-2007 Simon Woodside. If no license is noted, rights are reserved.

Valid XHTML 1.0 strict? Made with AxKit and Saxite.