Link to home
Start Free TrialLog in
Avatar of sow56091
sow56091

asked on

route command -- default gateway beginner question

Hi experts,

I'm new to Debian, but not networking. My linux machine keeps *losing* its ability to route. When I issue the route command, it *occasionally* appears to slow down horribly (about 60 seconds to return results) while displaying the default routes and I cannot reach the machine remotely until I issue a /etc/init.d/networking restart. The route command returns the following (the actual public IPs listed below are fictional):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
64.11.11.0    *               255.255.255.0   U     0      0        0 eth1
default         1.11.11.64.in 0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

I'm running Debian Sarge with bind9. /etc/network/interfaces looks like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The private network interface
auto eth0
iface eth0 inet static
address 192.168.0.16
netmask 255.255.255.0
gateway 192.168.0.1

# The public network interface
auto eth1
iface eth1 inet static
address 64.11.11.189
netmask 255.255.255.0
gateway 64.11.11.1

here's some bind info:
;
; BIND data for reverse lookup zone of company.inc.
;
$TTL    604800
@       IN      SOA     dns1. company.inc. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
16      IN      PTR     dns1
15     IN      PTR     admin
@       IN      NS      dns1
~

===========================

So, I'm wondering (1) why is it losing its default route occasionally and (2) How do I configure the default gateway per interface?
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tbittlingmayer
tbittlingmayer

Hi Sow,

That's what I thought, too.

 I assume that your private eth0 is connected to the internal lan and on the same subnet as the client machines (192.168.0.xxx netmask 255.255.255.0). No routing happens here.

The default route is needed when a packet has another destination than your private subnet. Then the router has to decide where to send that packet and uses its default route to forward it to the "unknown" network.

Therefore you only need ONE default route in your config. You may add it using "route add default gw XXX.XXX.XXX.XXX" command or using the gateway option in your configuration.

Hope that helps.

Regards,
Thomas