Gateway not gatewaying

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Gateway not gatewaying

Postby sproot » Sun Feb 27, 2011 11:50 am

This might well be user error, but I can't get my dual homed server to gateway.

There are two NICs:
Code: Select all
# The internal network interface
auto eth0
iface eth0 inet static
        address 192.168.1.4
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
# Outside interface                                                         
auto eth1
iface eth1 inet static
        address 192.168.2.4
        netmask 255.255.255.0
        network 192.168.2.0
        broadcast 192.168.2.255
        gateway 192.168.2.1

The routing table looks OK to me:
Code: Select all
# ip route
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.4
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.4
default via 192.168.2.1 dev eth1  metric 100

Forwarding is enabled:
Code: Select all
# cat /proc/sys/net/ipv4/ip_forward
1

I was using shorewall, but I cleared it when the problem struck:
Code: Select all
# iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

But I can't ping even from one NIC to the other:
Code: Select all
# ping -I eth0 192.168.2.4
PING 192.168.2.4 (192.168.2.4) from 192.168.1.4 eth0: 56(84) bytes of data.
From 192.168.1.4 icmp_seq=1 Destination Host Unreachable


It was working, until I was messing around with the patch cables and managed to get them swapped over. I've corrected them now but it no longer seems to pass packets between interfaces. I noticed because squid (transparently proxying) stopped working, other stuff on the box (postfix, dovecot, getmail, dnsmasq) is working fine, the internal NIC is visible from the internal network, the external NIC can access the 'net.

I've rebooted (more than once) but the problem persists, any network gurus spot anything obviously wrong?

TIA
sproot
sproot
 
Posts: 10
Joined: Mon Aug 13, 2007 8:55 pm

Postby Dutch_Master » Sun Feb 27, 2011 4:28 pm

As you swapped over the cables, the router (assuming you use one) has given them a TTL in its cache. Reset the router (or flush the entries from the cache) then reboot the network interfaces (ifdown eth0/1 then ifup eth0/1) on the server. Find out why Squid isn't working, fix it and have it restart.

PS: are you sure the netmasks are correct? With 255.255.255.0 they can only see other interfaces in the 192.168.1.x or 192.168.2.x ranges...
Dutch_Master
LXF regular
 
Posts: 2445
Joined: Tue Mar 27, 2007 1:49 am

Re: Gateway not gatewaying

Postby indie » Mon Feb 28, 2011 1:36 pm

sproot wrote:
Code: Select all
# ping -I eth0 192.168.2.4
PING 192.168.2.4 (192.168.2.4) from 192.168.1.4 eth0: 56(84) bytes of data.
From 192.168.1.4 icmp_seq=1 Destination Host Unreachable



You're trying to ping eth1 (192.168.2.4) from eth0 (192.168.1.4) when there's no route to 192.168.2/0/24 from eth1, it won't work.

Connect another machine to eth0 and make sure that's got it's default route set to 192.168.1.4 then try pinging 192.168.2.4 and that should work.
indie
LXF regular
 
Posts: 135
Joined: Thu Dec 06, 2007 12:00 pm

Postby sproot » Fri Mar 04, 2011 1:42 pm

Yeah, user error :oops:

I was expecting that doing, for example, a traceroute from 192.168.1.x to 192.168.2.x would show 192.168.1.4 and 192.168.2.4 as hops, because the gateway is routing between the two networks. It doesn't, it just shows the source interface as a hop.

The issue was that the return route from the default gateway on the 192.168.2.0 network was wrong, packets were going out but didn't have a route back. When I fixed that it started working.

Doh!

Thanks
sproot
sproot
 
Posts: 10
Joined: Mon Aug 13, 2007 8:55 pm


Return to Help!

Who is online

Users browsing this forum: No registered users and 3 guests