Review your favorite Linux distribution.
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 04-15-2006, 11:56 PM   #1
Registered: Oct 2005
Location: Bangladesh
Posts: 471

Rep: Reputation: 30
Cool Masquarade rules for NAT

Friends ,

I have a Redhat Linux Enterprise machine.I want to make it a NAT server . Here i use 3 lan card (Suppose , eth0 , eth1 ,eth2) , Where eth0 is connected with internet connection directly. eth1 and eth2 is connected with my different Lan connection . In this moment i need to IP MASQUARADE rules (using IPTABLES) so that my lan1 and lan2 network can connect with the Internet .

Old 04-16-2006, 12:33 AM   #2
Registered: Nov 2005
Distribution: Slackware, and of course the super delux uber knoppix universal live recovery cd
Posts: 429

Rep: Reputation: 30
actually you don't need to use iptables to do what your trying to do.
echo 1 > /proc/sys/net/ipv4/ip_forward
that should do it.
Old 04-16-2006, 06:34 PM   #3
Senior Member
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
actually you don't need to use iptables to do what your trying to do.
Sure you do, otherwise IPtables won't SNAT the packets...

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
is the key rule. If you have a static IP address (internet side), you will want to use proper SNAT instead of Masquerade, as Masquerade has extra code to deal with dynamic IP connections which makes it less efficient.

This should help:

That said, you still need to add the ip_forward functionality as chrisortiz shows...

Last edited by bulliver; 04-16-2006 at 06:36 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 rules for emule in nat box eantoranz Linux - Networking 3 08-08-2005 10:37 PM
How to show rules in nat table? mrpc_cambodia Red Hat 2 09-26-2004 11:04 PM
setting a masquarade-in . PLEASE HELP body00 Linux - Networking 2 09-10-2003 01:19 PM
Viruses, ipchains, dynamic rules, rules with regular expressions marktaff Linux - Security 2 09-25-2001 05:01 AM
iptables -t nat -L not showing all rules alpha-wolf Linux - Networking 0 08-14-2001 07:36 AM

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