Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 07-14-2003, 01:39 PM   #1
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
Linux router IPTABLES Howto

If someone will host the script, let me know and I'll edit this post.

Moderators, please sticky this.

Eth devices considered, eth0 eth1, one being WAN, one being internal LAN. Do not try to run this script remotely, you will be disconnected.

Last few lines must typed in console:

Flushing IP Tables Configuration

service iptables stop
service iptables save
service iptables start

Setting Default Rules

iptables -A INPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP

Securing Connections

iptables -A FORWARD -i eth1 -o eth0
iptables -A FORWARD -i eth0 -o eth1

iptables -P INPUT DROP
iptables -P FORWARD DROP

Please type the following:
ethX = WAN
ethZ = LAN
iptables -A INPUT -i ethZ -j ACCEPT
iptables -A INPUT -i ethX -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE

Last edited by hakcenter; 08-08-2003 at 05:54 PM.
Old 07-14-2003, 09:03 PM   #2
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545
With all due respect, I think this is a bit terse to call it a "Linux router IPTABLES Howto". You say "Eth devices considered, eth0 eth1, one being WAN, one being internal LAN" but looking tru this I spot 6 devices: eth{0,1,X,y,z,Z}. IMHO it cannot be considered complete w/o brief explanation, maybe a discussion could help you make it better.


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
howto relay ISPs dhcp ip's though linux router to LAN deice Linux - Networking 0 09-20-2004 11:40 AM
Linux Router HOWTO help required. adityanag Linux - Networking 2 09-15-2004 04:32 AM
Linux Gateway+Two NICS+Router+HOWTO pin_bk Linux - Networking 11 09-07-2004 12:29 PM
Howto setup two stage firewall? Linux and router-in-a-box? drdirt Linux - Security 5 01-10-2004 02:51 AM
isight through a linux router/firewall (iptables) rob_roman23 Linux - Networking 2 07-23-2003 10:19 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:01 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