42.9.3.4. IPTables Match Options

42.9.3.4. IPTables Match Options

Different network protocols provide specialized matching options which can be configured to match a particular packet using that protocol. However, the protocol must first be specified in the iptables command. For example, -p <protocol-name> enables options for the specified protocol. Note that you can also use the protocol ID, instead of the protocol name. Refer to the following examples, each of which have the same effect:

 iptables -A INPUT -p icmp --icmp-type any -j ACCEPT  iptables -A INPUT -p 5813 --icmp-type any -j ACCEPT 

Service definitions are provided in the /etc/services file. For readability, it is recommended that you use the service names rather than the port numbers.

Important

Secure the /etc/services file to prevent unauthorized editing. If this file is editable, crackers can use it to enable ports on your machine you have otherwise closed. To secure this file, type the following commands as root:

 [root@myServer ~]# chown root.root /etc/services [root@myServer ~]# chmod 0644 /etc/services [root@myServer ~]# chattr +i /etc/services 

This prevents the file from being renamed, deleted or having links made to it.