Click to See Complete Forum and Search --> : First excursion into networking - need to setup internet gateway


Spacecake
03-05-2002, 08:04 PM
I have been reading docs and fiddling *all day* now, about 12 hours.

This is my first time trying to do any networking at all, i am totally inexperienced... although i know all other aspects of linux pretty well.
Just incase you wanted to know, i use slack 8, and my current kernel is 2.4.17.

Right now, i just have my main computer (running linux like above, this will be the box connected to the internet [via ppp] and thus serve as the gateway) on 192.168.0.1, and another box running windows (192.168.0.2) connected via crossover cable.
Everything is working fine inbetween these two boxes, the windows one can request a page off the apache server on my linux box, i can telnet to it, set up samba shares that work either way, etc...
But i just cannot seem to get the windows box to access the internet.

I set up the ethernet card like this:

/sbin/ifconfig eth0 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0

And that's really all i have done. I know i have to set up IP Masquerading, but i keep following the instructions in every howto i can find and they all bring up errors i don't understand, or don't do anything at all.

I configured windows (clicked the properties thingie on TCP/IP) to use 192.168.0.1 as its gateway, which was the only option i could find relevant to this.

I get the feeling that all i need to do is issue the right iptables commands and i'll be okay, i just need someone to help me with WHAT the hell i need to type.

Sorry this doesn't provide that much info, i really don't know what i am talking about when it comes to networking.

Spacecake
03-05-2002, 08:40 PM
Okay, fiddling around and i know this is insecure, but it should work, yes?

iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT

So... why doesn't it? I can't ping anything on the internet from my box that is using this one as a gateway. Do i need to add something to the routing table? How?
argh

Spacecake
03-05-2002, 09:05 PM
This always happens. As soon as i make a post to LNO, i start managing to figure things out :o

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I can now ping machines on the internet from the windows box, but using IP address *only*. I set the DNS configuration in windows, but for some reason i can't seem to ping the DNS servers of my ISP from that box like i can everything else and so it can't contact them to resolve the names.
I am assuming i have to put my local box as a DNS server and then set that up to resolve the domains for the windows box?
How do i get this to work? Right now, windows wont even recognise local domains (in /etc/hosts) with 192.168.0.1 as its DNS server. Do i have to have some special service running?