IP Masquerading & routing in RH8.0

TonyB

Senior member
May 31, 2001
463
0
0
I currently have Pacbell DSL enhanced that includes 5 IP packages. All 5 IP's are in use right now, the way it works now is I got all 5 of my computers connected to a 3com switch, my dsl modem is also connected to the switch. I assign the gateway IP and the static IP to each of the computers and it works perfectly.

On my 5th system, I am running Redhat linux 8.0, it has its own assigned IP and connects to the net fine just like my other computers. My problem is I want to add another computer but i dont have any more IP's to assign it and I dont feel like paying more $$ to get more. I was wondering if it was possible to configure the red hat box to become a router and DHCP server so that when I connect more computers to the 3com switch they can assign the gateway as the redhat box instead of the dsl modem and be automatically assigned a private IP to access the net. All this while still having the older 4 computers retain their original static IP's and assigned gateway through the dsl modem.

Ive been reading a bit about IP Masquerading for linux and i wasnt quite sure if it works in my situation. Ive also considered buying a dsl router, but also not sure if it'll work. if anyone can offer some help i'd appreciate it.. also i dont know much about linux, only thing that my redhat box is running is a Samba server that im using to host/share my mp3's.
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
1.) put this in a text file (lets say firewall.sh)
2.) pico /etc/sysctl.conf and change net.ipv4.conf.default.rp_filter = 0 to net.ipv4.conf.default.rp_filter = 1
3.) run "/etc/init.d/iptables stop"
4.) run "./firewall.sh"
5.) run "/etc/init.d/iptables save"
6.) run "/etc/init.d/iptables restart"

voila, your redhat box will now NAT-route. As for setting up dhcpd, sorry i don't know it, try finding an article or howto with google.

(oh and btw, some people will whine that thats not enough of a firewall. some people are whiners.)

bart
 

FUBAR

Senior member
Oct 11, 1999
618
0
0
While I haven't looked at the script, you're probably going to want to put 2 nics in the RH box, and then add a switch to the second nic to plug more pc's into. This will make getting to your other pc's on the local network (those on the 3com) kind of tricky though.

That's the standard way to do linux NAT and such. You'll also have to make your box into a dhcp server, which isn't hard either. Go to www.linuxdoc.org and look for the howtos on ip-masquerading and also dhcp-server.
 

MetroRider

Senior member
Jun 11, 2001
433
0
0
Ive also considered buying a dsl router, but also not sure if it'll work. if anyone can offer some help i'd appreciate it..

The suggestions given so far are good. However, a dsl-router wouldnt be a bad choice in this situation either, and here's why:

You could connect the 5th IP to go to the dsl-router, and have that machine dish out internal ip's for all future pc's which would be connected to it. That way, you would cut the RedHat box out of the picture, and not need it on 24/7 for sharing internet access to any pc's connected to it, as the router would take care of this. However, with the RedHat box, you would have more control of its settings, as you could really set up some advanced options and firewalls that even today's routers dont carry, but I think that for what you would want to do, a 4-port Linksys DSL router would be a good option for you. They only cost around $70 if not less.

If you want to try the RH routine though, please go ahead and give it a shot as well. Once you learn IP Masquerading and can get it to work, it's truly a neat thing and a nice skill to know indeed!

Good luck! :)

-Metrorider