LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-05-2010, 07:52 AM   #1
ajkannan83
Member
 
Registered: Aug 2005
Location: Tamil Nadu, India
Distribution: Redhat, Fedora
Posts: 120

Rep: Reputation: 15
NAT Problem


Dear Sir,

We are using Broadband 2 Mbps (India) connection in Redhat Linux 5.
In Server there are two network card.

One is connected to Broadband another one is connected to LAN

that means

Eth0 Address : 192.168.0.5/255.255.255.0 gateway 192.168.0.1

Eth1 Address : 10.0.0.5 /255.0.0.0

How to configure NAT in Linux Machine

#iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 192.168.0.5
#echo 1 > /proc/sys/net/ipv4/ip_forward

Is this correct or not?
 
Old 08-05-2010, 08:08 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Seems reasonable, though you also want to turn on ip forwarding in your sysctl.conf file so that your forwarding persists over reboots and shutdowns
 
Old 08-05-2010, 10:40 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,213

Rep: Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614Reputation: 1614
http://lmgtfy.com/?q=2+card+nat+iptables

There are millions of examples of doing this with IPtables. 100's of them are on this forum.

Try and do some research before asking a question that has already been asked and answered over and over again.

iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT

I wouldnt bother using iptables. Get OpenBSD and use pf(). Of course, that would mean reading the manual though.
 
  


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
Please help in NAT problem vidhyaprakash85 Linux - Networking 8 11-15-2008 01:10 PM
NAT problem Braynid Linux - Newbie 1 03-26-2007 04:20 AM
NAT problem kurrupt Linux - Security 7 11-29-2004 11:19 PM
Susefirewall2 Nat Problem / nat 1:1 trubi Linux - Distributions 0 07-20-2004 06:50 AM
What's the difference between Linux-NAT and Sygate-NAT? yuzuohong Linux - Networking 0 08-07-2002 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:05 PM.

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