Welcome to the Linux Foundation Forum!

How to add an IPTABLE rule

Hi smart people,

I am quite new to iptables.

How do i add a rule to allow only traffic from the 172.16.0 network through on port 7210. also get it to specify an interface too.

I really appreciate it urgently

Comments

  • Use below command to allow only traffic from the 172.16.0 network through on port 7210
    iptables -A INPUT -i eth0 -p tcp -s 172.16.0.0/16 --dport 7210 -j ACCEPT
  • Syntax:


    iptables -A chain Linux firewall-rule
    • -A chain – Specify the chain where the rule should be appended. For example, use INPUT chain for incoming packets, and OUTPUT for outgoing packets.
    • firewall-rule – Various parameters makes up the firewall rule.
  • coop31
    coop31 Posts: 5

    Also I would suggest to pay attention at Shorewall, which is great firewall generator for Iptables which allows advanced configuration with simple configuration files. It is available from the Ubuntu repositories via apt-get. If you are looking for a exceptional GUI to configure Iptables, Firestarter is a solution. However, Firestarter conflicts with ufw. Iptables tutorials for professionals.

  • Syntax:


    iptables -A chain firewall-rule
    • -A chain – Specify the chain where the rule should be appended. For example, use INPUT chain for incoming packets, and OUTPUT for outgoing packets.
    • firewall-rule – Various parameters makes up the firewall rule.
  • Give this article a browse as it covers what you are trying to do. 

    http://www.systutorials.com/816/port-forwarding-using-iptables/

Categories

Upcoming Training