Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Gateway not gatewaying

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
sproot



Joined: Mon Aug 13, 2007 9:55 pm
Posts: 10

PostPosted: Sun Feb 27, 2011 11:50 am    Post subject: Gateway not gatewaying Reply with quote

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

There are two NICs:
Code:
# 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:
# 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:
# cat /proc/sys/net/ipv4/ip_forward
1

I was using shorewall, but I cleared it when the problem struck:
Code:
# 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:
# 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
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2439

PostPosted: Sun Feb 27, 2011 4:28 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
indie
LXF regular


Joined: Thu Dec 06, 2007 12:00 pm
Posts: 135

PostPosted: Mon Feb 28, 2011 1:36 pm    Post subject: Re: Gateway not gatewaying Reply with quote

sproot wrote:

Code:
# 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.
Back to top
View user's profile Send private message
sproot



Joined: Mon Aug 13, 2007 9:55 pm
Posts: 10

PostPosted: Fri Mar 04, 2011 1:42 pm    Post subject: Reply with quote

Yeah, user error Embarassed

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
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast