LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   cannot connect to internet via gateway (https://www.linuxquestions.org/questions/linux-networking-3/cannot-connect-to-internet-via-gateway-229762/)

cbunney 09-12-2004 03:52 PM

cannot connect to internet via gateway
 
Hi,

I am a fairly new Linux user and very new to networking!

I have set up a small (2 computer) private network. I have one machine running Mandrake Linux 10.0 (kernel 2.6.3-7) which is connected to the internet via a modem using PPP and is also connected via ethernet to my private local network.

My second machine is running TINY Linux (kernel 2.2.6) and is connected to the private network only.

I have managed to set up both so that they can talk to each other (ping, NFS, ftp etc) and wanted to set up the machine connected to the internet as a gateway. I have gone through all the steps I can find in various howto's etc but I just cannot access the internet from my private network.

I have set up a gateway machine using 'route add' and if I ping an external site such as 'yahoo' it manages (after a small delay) to resolve the name to an IP address, but it cannot access it.

What am I doing wrong? Do I need to set up some sort of packet routing on my gateway. Here is the output of 'route -n' from the gateway:

--------------------------
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
195.92.66.197 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 195.92.66.197 0.0.0.0 UG 0 0 0 ppp0
--------------------------

And from the machine on my private network:
--------------------------
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
--------------------------

One thing that I have done is stopped shorewall - my firewall program - as it was blocking my connections to and from the two machines - would this cause a problem?

Any help would be appreciated.

Regards.

bulliver 09-12-2004 04:09 PM

If the computer in your private network is using an RFC1918 private IP address (ie 192.168.x.x) then you need to set up IP Masquerading on your gateway machine.

The howto is a bit out of date but should help you out:
http://www.ecst.csuchico.edu/~dranch...tml/index.html

There is no info on 2.6.x kernels but the info for 2.4.x kernels should still be relevant as far as kernel modules you will need.

Here is another link for IP Masq info:
http://www.e-infomax.com/ipmasq/

cbunney 09-13-2004 06:33 AM

Thanks bulliver,

I have managed to get my gateway to work using the links you gave me....I am not entirely sure HOW it is working (as I just copied the rc.firewall script)....but it works nethertheless....!!!

Cheers for your help.

bulliver 09-13-2004 03:13 PM

Quote:

.I am not entirely sure HOW it is working (as I just copied the rc.firewall script).
Well that was easy huh! :)

My guess is that if you are using a stock kernel, then all the modules you needed were built and waiting to be loaded. The firewall script itself has code that loads the modules, so you were off to the races.

Just remember that if you build a custom kernel you should follow the advice in the howto to make sure the needed modules get built.


All times are GMT -5. The time now is 09:21 PM.