LinuxQuestions.org
Visit Jeremy's Blog.
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 03-13-2008, 03:42 PM   #1
kromberg
Member
 
Registered: Feb 2007
Location: Colorado
Distribution: FC6, FC7 x86_64
Posts: 218

Rep: Reputation: 30
Help with RHEL5 and IP Masquerading


I have two mchaines which one is pysically connected to the internet, the RHEL5 machine, and a second machine that is connected to the first via a crossover cable. The RHEL5 has two NIC cards. eth0 is connected to the internet via a DHCP server. eth1 has a static address of 192.168.1.1. The second machine that I would like to have internet access to has a single NIC and a static address of 192.168.1.2 with a gateway set to 192.168.1.1. Would I just ahve to run the following command on the RHEL5 machine to give internet access:

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

TIA,
Keith
 
Old 03-13-2008, 05:52 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
You also need to run this command to enable ip forwarding as well.
echo "1" > /proc/sys/net/ipv4/ip_forward
Then the one you mention.
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

You can place both of those commands in /etc/rc.local so they are ran on boot. Be sure to use the full path of each command.

Now a few things to configure. Set the eth0 as the Internet wan connection like you mention getting the DHCP IP. Now with the eth1 set the IP and Subnet info. Do Not Set a gateway on this nic.

I presume you are still going to leave current iptables service enabled on the machine. If not I would do the following.

I would perform a bit better firewalling if any ports are to be opened on the RHEL5 Internet router box. I would goto here and answer the questions to configure a very secure and simply router script and place this script to be runned in /etc/rc.local. You will need to disable the RHEL5 default firewall if you go that route.
 
  


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
Help with RHEL5 and IP Masquerading kromberg Red Hat 2 03-13-2008 07:39 PM
IP Masquerading ? emailssent Linux - Networking 1 10-07-2004 10:49 PM
masquerading ichbinesderelch Linux - Networking 23 08-19-2003 03:18 AM
IP masquerading. somebody help me! Johnsernickle Linux - Networking 4 10-22-2002 06:57 PM
ip masquerading artman62 Linux - Security 5 08-13-2002 07:57 PM

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

All times are GMT -5. The time now is 07:57 AM.

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