How to specify port ranges in /etc/services???

Issues related to configuring your network
Post Reply
KMorley
Posts: 28
Joined: 2006/10/20 16:59:51
Location: Tampa, Florida

How to specify port ranges in /etc/services???

Post by KMorley » 2007/03/01 14:35:58

I need to modify /etc/services to include additional protocols. SIP is easy, since it's 5060/udp. RTP is a user-defined range of ports and I'm currently using 16384 thru 16999.

Can anyone tell me how to express a port range in /etc/services? With that in services, I can pretty easily use system-configure-securitylevel to setup iptables.

Thanks!

michaelnel
Posts: 1478
Joined: 2006/05/29 16:50:11
Location: San Francisco, CA

How to specify port ranges in /etc/services???

Post by michaelnel » 2007/03/01 18:14:32

[quote]
KMorley wrote:
I need to modify /etc/services to include additional protocols. SIP is easy, since it's 5060/udp. RTP is a user-defined range of ports and I'm currently using 16384 thru 16999.

Can anyone tell me how to express a port range in /etc/services? With that in services, I can pretty easily use system-configure-securitylevel to setup iptables.[/quote]

I don't know how to specify a range of ports in /etc/services other than listing them one port number per line with matching udp/tcp pairs. Defining a range of ports in iptables is easy though. I have this for Bacula, for instance, to cover ports 9101, 9102, and 9103:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9101:9103 -j ACCEPT

I would forget about adding that large range for RTP to services. Just add it manually to /etc/sysconfig/iptables with your favorite editor.

Post Reply

Return to “CentOS 4 - Networking Support”