LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-15-2008, 06:06 PM   #1
jasboy
LQ Newbie
 
Registered: May 2004
Posts: 24

Rep: Reputation: 15
Open certain ports across different subnet -- iptables


I wasn't sure if this went in Networking or Security...

I am running a ZoneCD server for a public wireless hotspot (publicip.net's forums are long gone.) and set it up so the wireless clients could not access our internal network using this iptables command: "iptables -t nat -A NoCat_Capture -i eth1 -d 192.168.5.0/24 -j DROP". Our wireless network is 10.10.10.x and our internal is 192.168.5.x. We now want to implement wireless printing and I need 2 ports opened on 1 internal ip address for the wireless clients to connect to (say, 192.168.5.213 port 30044 and 21326) but I still need the rest blocked. I'm pretty new to iptables and I'm not sure the best way to do this with iptables.

Thanks.
 
Old 04-16-2008, 10:51 AM   #2
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
This is pretty straightforward: insert the rules accepting packets for your printer address/port combinations before the DROP rule; since iptables stops processing rules when it gets to one that tells it what to do, this will result in your print packets being accepted and everything else dropped.
 
Old 04-16-2008, 01:24 PM   #3
jasboy
LQ Newbie
 
Registered: May 2004
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks for the reply. So would this be the proper iptables command: "iptables -t nat -I NoCat_Capture -i eth1 -d 192.168.5.213 --dport 30044 -j ACCEPT" in order to allow packets to 192.168.5.213 port 30044?

Thanks again.
 
Old 04-16-2008, 11:36 PM   #4
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
This is close, but the -t option is wrong. This rule goes in the (default) filter table, not the nat table. Come to think of it, your DROP rule ought to be there as well.

Normally, Private Networking addresses (10.x.x.x and 192.168.x.x are both in this category) are not permitted to travel on the public Internet, but since you have both of these under your control, you do not need to do NAT on any of these until they are about to go out on the public Internet.

It is not clear from your post whether you are doing NAT on the firewall machine, or if you have some other device (a router, perhaps) doing NAT for you. It might make a difference in how you write the rules, but in either case, you do not need to do DROPs in the NAT table.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open ports using iptables neelay1 Linux - Security 4 07-25-2006 07:50 PM
open ports with iptables? vijaysh Linux - Networking 2 12-27-2004 06:54 AM
open ports with iptables? tykkea811 Linux - Networking 2 12-12-2004 01:43 AM
iptables and open ports benjithegreat98 Linux - Networking 5 12-23-2003 08:12 AM
IPtables open ports Paul_assheton Linux - Security 3 10-10-2003 02:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration