View Full Version : Linux as a gateway for windows machines
see7a
Hi shabab,
I am trying to set a small home network using my 2 pcs. I want to use linux - Red Hat 9.0 - as a gateway and connect the other machine - Win XP - to the internet through it.
Now I have linux connected to the internet and I can surf the net without any problem. also, I have dhcpd enabled and the windows machine obtains a valid ip each time it starts.
The part that's not working is that the windows machine cannot access the internet. I can't even ping anything on the outside world.
Now, my question is: should I look for some missing setting in dhcpd config or maybe I am missing something bigger than that ?
maybe I should setup iptables to do some IP masquarading :confused:
Thanx for your time
uniball
1st: You'll need to setup masqurading.
2nd you'll either act as the DNS for the windows machine "overkill for a small network"
or give windows the DNS .
you can have a look at the masquerading howto
Tell me if u need help ON THE LINUX SIDE!
venom
Let me add the practical steps:
First: Have dhcpd properly set up the clients:
add these lines to your /etc/dhcpd.conf
option routers 192.168.0.1; # replace with your linux box ip
option domain-name-servers hostname; # replace with your linux box hostname.
Second: tell kernel to masquerade & route packets
add these to your /etc/ppp/ip-up script:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE # masquerade packets going out interface ppp0
echo 1 > /proc/sys/net/ipv4/ip_forward # enable kernel forwarding feature
That should do it. Let me me know how it goes :)
Oh, by the way, this assumes you're running named on your linux box. If not then drop the domain-name-servers line & just type in your ISP's DNS in Control Panel/Network on the Windows machines.
angoranimi
Originally posted by uniball
2nd you'll either act as the DNS for the windows machine "overkill for a small network"
Not really. If you set up djbdns's tinydns and use it as the DNS server for both your linux and windows boxes, that would be perfect.
As a matter of fact, I recommend overriding DNS servers recieved by the PPP connection with the local tinydns server. Why? Because tinydns will only crash if your system crashes (or something of the sort), however, chances are, your ISP's dns might crash alot more often and might be alot slower.
LI-6Y LUCY
asalamu 3lekom,
is there any official tutorials talking about this problem ???
ThnX AloT.
uniball
Originally posted by angoranimi
Not really. If you set up djbdns's tinydns and use it as the DNS server for both your linux and windows boxes, that would be perfect.
As a matter of fact, I recommend overriding DNS servers recieved by the PPP connection with the local tinydns server. Why? Because tinydns will only crash if your system crashes (or something of the sort), however, chances are, your ISP's dns might crash alot more often and might be alot slower.
I didn't try djpdns' tinydns. I was talking about bind and i don't know why i thought that i wrote its name in my post ;-)
yes I agree on using a caching DNS server, I used to use pdnsd but it wasn't very stable.
LI-6Y LUCY: Linux IP Masquerading howto
It's easy as:
iptables -t nat -A POSTROUTING -i eth1 -o eth0 -s 0.0.0.0/0 -j MASQUERADE
where eth0 is the extermal interface!
see7a
Hey,
I got it working now thanks to your help :)
Masquarading worked just fine as soon as I copied the 2 lines. I used bind (named) as DNS server, and I really think it's not taking so much resources. maybe I'll try some lighhtweight dns server later.
thanx again and keep up the good work ;)
ErrorMsg
www.daif.net/linux/ar/network.html
vBulletin v3.0.1, Copyright ©2000-2004, Jelsoft Enterprises Ltd.