LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 06-15-2010, 03:46 PM   #1
czezz
Member
 
Registered: Nov 2004
Location: Poland/Warsaw
Distribution: Slackware/Solaris
Posts: 555

Rep: Reputation: 30
NAT with MASQUERADE only for eth2 ?


This is my Linux box with NAT (Slackware 12):

eth0: [public IP]
eth1: 192.168.1.1
eth2: 172.16.1.1

iptables configuration:
Code:
modprobe iptable_nat
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
So, above config refers to both eth1 and eth2.
Is this possible make NAT with MASQUERADE only for eth2 ?
 
Old 06-16-2010, 11:08 AM   #2
jp413
LQ Newbie
 
Registered: May 2005
Location: United States
Posts: 4

Rep: Reputation: 0
Yeah, specify an input interface (-i) and/or source IP range (-s) in the iptables rule.

e.g.

Code:
iptables -t nat -A POSTROUTING -i eth2 -o eth0 -j MASQUERADE
or
Code:
iptables -t nat -A POSTROUTING -s 172.16.1.1/<netmask> -o eth0 -j MASQUERADE
where <netmask> is the interface's netmask, seeable with
Code:
ip addr show dev eth2
 
  


Reply


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
NAT/Masquerade not working? eswenson Linux - Networking 3 06-04-2010 02:08 PM
iptables masquerade nat portforwarding problem borborygmis Linux - Networking 5 08-14-2008 01:51 AM
eth2 briankb713 Linux - Hardware 0 01-04-2005 08:28 PM
nat/masquerade, connection tracking b0uncer Linux - Networking 2 07-20-2004 04:22 AM
iptables - true nat AND masquerade rebuke Linux - Security 3 11-11-2003 02:02 PM


All times are GMT -5. The time now is 10:35 AM.

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