Click to See Complete Forum and Search --> : can't ping default gateway from windows client


bandwidth_pig
03-29-2003, 10:27 PM
I have a small home LAN. I wanted to try setting up Debian as a DHCP server for my windows machine and as a router for it. The network topology lies out like so:

1. Cable modem facing WAN/ISP
2. Linksys router facing Debian box performing DHCP for eth0 facing Linksys router.
3. 2nd NIC in Debian router connected to Windows machine via a cross over cable and plugged into Windows Machine NIC. Debian 2nd NIC is eth1.

DHCP to the windows machine works. It doesn't work well, but it works. I seem to have to for some reason kill DHCPD and then restart it and then the windows machine will pick up the DHCP offer from the Debian box. IPs are as follows:

1. Linksys router: 192.168.1.1
2. Debian machine: 192.168.1.103 for eth0
3. Debain machine: 192.168.1.1.102 (hard coded via ifconfig) for eth1
4. Windows machine: 192.168.1.100 via DHCP from Debian machine.

I can ping both 192.168.1.103 and 192.168.1.102 from the windows machine. I can't ping 192.168.1.1 from the windows machine and I can't get to the internet from it.

To create routes, I have been using iproute. My iproute table looks like so:

192.168.1.100 via 192.168.102 dev eth1
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.103
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.102
default via 192.168.1.1 dev eth0

I added the first line statically. The others were there by default. Anybody have any insight into how to make it so my windows machine can hit the default gateway? Once I get this working ok I'll most likely toss the linksys router. I want to do packet shaping between the debian machine and the windows client and I can't do that with the linksys. Advice and input most appreciated (I did quite a bit of Google searching before posting).

bandwidth_pig
03-29-2003, 10:30 PM
Forgot my dhcpd.conf:

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers XX.XX.XX.XX

subnet 192.168.10 netmask 255.255.255.0{
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}

I have tried changing the router line to both my eth0 and eth1 with no luck as far as the windows machine goes :D

Magueta
03-30-2003, 02:08 AM
I realize that this may seem simplistic but my first reaction would be to check my firewall to see if I'm allowing packets to pass outward from eth0. I can see that you have the packets forwarded from eth1 to eth0 ok because you can ping the ip for eth0, but perhaps you have to setup a rule to allow the packet to pass through eth0.

Joe

cowanrl
03-30-2003, 11:02 AM
There are several problems you are going to have trying to access the Internet from your Windows machine but your biggest problem is that you have both eth0 and eth1 in your Linux box on the same IP subnet. Unless you want to configure your Linux box as a bridge, that won't work.

Change the IP address settings on the eth1 network from 192.168.1.0/24 subnet to 192.168.2.0/24 subnet. It should be just a matter of changing the 1 to a 2 in all of your configuration files.
Also in dhcpd.conf, change:

option routers 192.168.1.1;

to:

option routers 192.168.2.102;

The default gateway for the Windows machine would be eth1 on the Linux box, not the IP address of the Linksys router.

To start your Linux box actually routing packets from eth1 to eth0, enter this command as root:

echo 1 > /proc/sys/net/ipv4/ip_forward

Once you accomplish all of this, you should then be able to ping the Linksys router from your Windows machine.

You can then proceed with the other issues you mentioned as far as eliminating the Linksys router.

bandwidth_pig
03-30-2003, 12:10 PM
Thanks conwanrl! I had to make a couple of additional adjustments to what you had said, but you certainly got me going in the right direction and I could figure out what additional tweaks had to be made. That was just the push I needed. If I may ask just a couple of more questions, I'll be well on my way to packet shaping in no time (well...more than likely not...but I can experiment).

1. Is there a way to make it so I don't have to assign the ip via ifconfig to eth1 each time I boot up? I thought this was done via /etc/network/interfaces. I had tried editing the file so that it would assign the IP I wanted and subnet mask each time I boot up. It looks like:

auto eth0
iface eth0 inet dhcp

auto eth1


I tried putting in:

auto eth1
iface eth1 inet 192.168.2.102

But that didn't work.

Also, am I going to have to echo the ip forwarding everytime I reboot? I thought perhaps I already had this enabled. Is there a way to check?

cowanrl
03-30-2003, 02:38 PM
I'm not familiar with Debian so I'm not sure what configuration files it uses for the Ethernet interfaces. In Red Hat and most of it's derivatives the file is

/etc/sysconfig/network-scripts/ifcfg-ethx

where x is the interface number. I'm not sure if that's what you use in Debian or not. Maybe some Debian user can enlighten you on it.

Is there a GUI with Debian? Sometimes it's easier to do it with a GUI config tool, although it's good to know what files need edited.

As far as the command to start IP forwarding, on some machines you can put it in:

/etc/rc.d/rc.local

That's a script file that is executed after everything else is started up. It's convenient for commands like that. Just put in the command exactly as you entered it at the command line.

You can also try editing:

/etc/sysctl.conf

If you have one, look for lines that say:

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

and change the 0 to a 1. If you have the file but the line isn't there, add it.