LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 06: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, 07:08 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
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, 09:40 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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



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

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

All times are GMT -5. The time now is 03:43 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
Open Source Consulting | Domain Registration