centos iptables, restrict tcp port to specific ips

Posted by user788171 on Server Fault See other posts from Server Fault or by user788171
Published on 2012-09-09T01:13:31Z Indexed on 2012/09/09 3:39 UTC
Read the original article Hit count: 508

Filed under:
|
|
|

I would like to modify the iptables on my CentOS 5.8 server so that only specific ips can connect to the machine on a specific port.

Currently, I have the following in my iptables file:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5000 -j ACCEPT

How would I modify that line if I wanted to allow access for only ips 1.1.1.1 and 1.1.1.2 for instance? (they might not necessarily be sequential ips when I do this for reals).

© Server Fault or respective owner

Related posts about centos

Related posts about iptables