Menu
Menu

How to add to and edit iptables

Posted in Linux on October 24, 2016
Tags: , ,

If you're using a firewall on your server, you'll want to edit your IPtables. Here's how you can add new IPs or edit existing ones. Remember port 22 is for ssh and port 21 for FTP.

  • vi /etc/sysconfig/iptables

Edit the IPs in /etc/sysconfig/iptables. Then save changes and run this command to commit changes

  • service iptables restart

Successful service iptables restart should result in this:

Flushing firewall rules: [  OK  ]
Setting chains to policy ACCEPT: filter [  OK  ]
Unloading iptables modules: [  OK  ]
Applying iptables firewall rules: [  OK  ]

Example of what iptables should look like

http://www.brandonhutchinson.com/iptables_fw.html

http://oceanpark.com/notes/firewall_example.html

http://www.iitk.ac.in/LDP/LDP/nag2/x-087-2-firewall.example.html

http://www.liniac.upenn.edu/sysadmin/security/iptables.html

Or search google for "example iptables config file"

One Response to “How to add to and edit iptables”

  1. shadowtrooper says:

    hi
    i am new with IP tables stuff and i have a problem....
    i have a pc Contain a fedora OS and i want to make a small network (4 PCs Contain XP OS) and using the pc of fedora OS as a firewall
    i want to Prevent the ping (i think it called(ICMP)) in the privat network and prevent one of the PCs from Browsing internet(prevent port 80 and 81 as i think)
    and i still don't know how to make the internet go Through the firewall to the private network...

    note: WAN = eth0
    LAN = eth1
    neeeeeed help plz!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *