You are not logged in.
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
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
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
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