LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-2006, 10:56 PM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 447

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 .

thx...
 
Old 04-15-2006, 11:33 PM   #2
chrisortiz
Member
 
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.
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
that should do it.
 
Old 04-16-2006, 05:34 PM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 68
Quote:
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...

Code:
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:
http://tldp.org/HOWTO/IP-Masquerade-HOWTO/

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

Last edited by bulliver; 04-16-2006 at 05:36 PM.
 
  


Reply

Tags
ip


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 09:37 PM
How to show rules in nat table? mrpc_cambodia Red Hat 2 09-26-2004 10:04 PM
setting a masquarade-in . PLEASE HELP body00 Linux - Networking 2 09-10-2003 12:19 PM
Viruses, ipchains, dynamic rules, rules with regular expressions marktaff Linux - Security 2 09-25-2001 04:01 AM
iptables -t nat -L not showing all rules alpha-wolf Linux - Networking 0 08-14-2001 06:36 AM


All times are GMT -5. The time now is 02:23 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration