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


  Search this Thread
Old 06-24-2004, 03:17 PM   #1
Registered: Aug 2003
Posts: 167

Rep: Reputation: 30
IPTables Question

I need to do the following on my Slackware box:

I need to be able to forward the following:

traffic on port 80 to
traffic on port 110 to
traffic on port 22 to

I need to be able to block the following domains from users within my LAN:

I need to disallow the following range of users from accessing the web:

I need to allow this range to access the web:

I need to block the following range of ports to ANY machine on my LAN from the web:

23 to 79

Can anyone tell me how this is done with IPTables?
Old 06-24-2004, 04:31 PM   #2
Senior Member
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
You could read the fine manuals around the world regarding to iptables
(there is also one in tutorial section, and comprehensive ones in

iptables -t nat -A PREROUTING --destination your.ip.address --destination-port 80 --jump DNAT --to-destination
iptables -A FORWARD --destination -j REJECT --reject-with icmp-admin-prohibited
and same to the other place. Also you can use DROP, if you don't want to be nice admin.

Why do you want to use so unround numbers? How about
disallowing 64-127 and allowing 128-159?
This can be archived by
iptables -A FORWARD -p tcp --source --destination-port 80 -j REJECT --reject-with icmp-admin-prohibited
iptables -A FORWARD -p tcp --source --destination-port 80 -j ACCEPT
You can use those ranges you suggested, but then you have to fight with them.
eg. for the the 101-199 range you have to repeat that command
with values:,,,, and

iptables -A FORWARD -p tcp -i yourINETInterface --destination-port 23:79 -j DROP

Last edited by ToniT; 06-24-2004 at 04:33 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
iptables question iomari Linux - Security 4 01-13-2005 12:14 AM
Iptables Question? unixfreak Linux - Security 1 09-01-2004 08:23 PM
iptables Question gauge73 Linux - Networking 3 12-14-2003 12:02 AM
IPtables Question jacovds Linux - Security 10 11-17-2003 09:46 AM
iptables question Texicle Slackware 7 01-19-2003 12:48 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:04 PM.

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