Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up NAT on RedHat 7.0 Server

Status
Not open for further replies.

bkonner

MIS
Apr 28, 2001
101
US
Hi,

I am just not sure what I am doing wrong. I am trying to set up NAT on a Linux server. I have two nic cards. Eth0 is the internal card and eth1 is the external card. Eth0 has a static address (10.100.201.1) while eth1 has a dynamic address from a cable modem. Eth1 connects to the modem through an RJ45 cable. The RedHat Linux server has internet access, but I can not get the internal network to connect to the internet. I can ping the internal card from within the network. I can access the RedHat Linux server from within the network using webmin.

I believe I am supposed to setup rules with ipchains. I have done the following:

(in the sbin directory)

./ipchains -P forward DENY
./ipchains -A forward -0 eth1 -j MASQ
echo 1 > /proc/sys/net/ipv4/ip_forward

I have done this, but I still can not access the internet.

I am lost. Any ideas what I am doing wrong.

Thanks,

bkonner
 
Hi,

With IPchains You need something like this :

echo 1 >/proc/sys/net/ipv4/ip_forward
/sbin/modprobe ipchains
/sbin/ipchains -P forward DENY
/sbin/ipchains -A forward -i eth1 -s 10.0.0.0/8 -j MASQ

(you need -i for the external interface)

Hope this helps
 
Hi,

I've tried this, but when i enter /sbin/modprobe ipchains I get the error that the modue can not be found. It is there; I just don't get what I am doing wrong.

Thanks for your help any way.
 
Hi,

Presumably you have a standard redhat kernel and not one you compiled yourself. It seems unlikely that you don't have ipchains, in fact its more likely that it would already be in memory ('sbin/lsmod' to list loaded modules) because its quite likely you have the 'ipchains' service running. Try doing this :

/etc/rc.d/init.d/ipchains stop

That will stop the basic redhat firewall (if its running) which will complicate matters if you're trying to test things. Then try again. Actually, it should work even with that firewall running by just a single line like :

/sbin/ipchains -A forward -i eth1 -j MASQ

All you are doing is adding (-A) to existing rules which you can see by doing :

/sbin/ipchains -L

To locate the ipchains modules you can use find :

find /lib/modules -name "ipchains*"

There should be one under the subdirectory for the kernel version you are running (as returned by the 'uname -r' command).

Is ipchains shown with a 'lsmod' ? Is it actually on the system ?

If its missing try downloading and installing this rpm --> ftp://rpmfind.net/linux/redhat/7.1/en/os/i386/RedHat/RPMS/ipchains-1.3.10-7.i386.rpm

Regards


 
Boy do I feel stupid. I made an error in the DNS setting, STUPID! Thanks for all of your help. This web page is great.

Bill Konner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top