You are not logged in.

#1 2012-04-24 07:28:02

multixrulz
Member
Registered: 2005-04-05
Posts: 25

Default route not getting set

I have a machine that refuses to set its default gateway.

Some history:
Using the /etc/rc.conf network configuration, I specified

interface=eth0
address=10.0.0.10
netmask=255.255.255.0
broadcast=10.0.0.255
gateway=10.0.0.138

Everything just worked.

After that, the machine had to be reconfigured for another network and shipped to head office.  The new settings were:

interface=eth0
address=192.168.0.250
netmask=255.255.255.0
broadcast=192.168.0.255
gateway=192.168.0.1

For some reason, the interface was brought up with the correct address, netmask, broadcast, and route for the local subnet.  But the default route wasn't being set. (Lots of trouble when you're trying to remote-administer...)

I decided to switch over to wicd, with the same settings.  Unfortunately I had the same result: everything worked EXCEPT for the default route.

At this moment I have things working by putting the following into /etc/rc.local:

/usr/sbin/ip route add default via 192.168.0.1

But this really isn't how it should be, and I hate the thought of some black magic going on behind the scenes -- I have to know what's going on.

Offline

#2 2012-04-24 07:43:19

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: Default route not getting set

Strange. Normally "ip route add default via $gateway" is called by /etc/rc.d/network during boot (you have network in your DAEMONS array, right?).


Burninate!

Offline

#3 2012-04-25 01:29:23

multixrulz
Member
Registered: 2005-04-05
Posts: 25

Re: Default route not getting set

Well I did have "network" in the daemons array.  Now it's "wicd".  For reference:

Wicd setup:

# cat /etc/wicd/wired-settings.conf 
[wired-default]
afterscript = None
dhcphostname = Server
postdisconnectscript = None
dns_domain = None
gateway = 192.168.0.1
use_global_dns = False
lastused = True
encryption_enabled = False
beforescript = None
ip = 192.168.0.250
broadcast = None
netmask = 255.255.255.0
usedhcphostname = 1
predisconnectscript = None
enctype = None
default = 1
dns2 = 210.23.129.34
search_domain = None
use_static_dns = True
dns3 = None
profilename = wired-default
dns1 = 210.23.129.33

daemons array in /etc/rc.conf

DAEMONS=(syslog-ng crond dbus alsa wicd FWBuilderScript ntpd sshd postgresql samba lighttpd slim)

/etc/rc.local:

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#

/usr/sbin/ip route > /root/boot-route
/usr/sbin/ip route add default via 192.168.0.1

and the contents of /root/boot-route, to see what's in the routing table before adding the default route:

# cat /root/boot-route 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.250 

Offline

#4 2012-04-25 03:35:48

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Default route not getting set

I'm a little surprised that there's no entry for loopback, e.g. this entry for "ip route":

127.0.0.0/8 dev lo  scope link


Can be set up with:
ifconfig lo 127.0.0.1 netmask 255.0.0.0 && route add -net 127.0.0.0 netmask 255.0.0.0 dev lo

Last edited by brebs (2012-04-25 03:37:23)

Offline

Board footer

Powered by FluxBB