/etc/rc.d/netif wont add default gateway

Wolfgang Zenker wolfgang at lyxys.ka.sub.org
Sun Dec 2 14:14:11 PST 2007


Hi,

* area damai™ <area.damai at gmail.com> [071202 21:42]:
> whenever i run /etc/rc.d/netif it will read rc.conf and add the pc IP and
> netmask but it wont read the default gateway resulting lost connectivity to
> internet

> # -- my /etc/rc.conf :
> defaultrouter="192.168.1.1"
> hostname="msc.edu"
> ifconfig_rl0="inet 192.168.1.9 netmask 255.255.255.0"
> [..]

> # -- while issuing /etc/rc.d/netif restart:
> [root at msc ~]# /etc/rc.d/netif restart
> Stopping network: lo0 rl0 plip0 pfsync0 pflog0.
> [..]

what happens is that "/etc/rc.d/netif restart" first runs
"/etc/rc.d/netif stop". This stops all network interfaces.
Now the kernel routing system gets notified that these interfaces 
are no longer available and deletes all routes that use this
interfaces.
After that "/etc/rc.d/netif start" runs and the interfaces
become available again. Every time a network interface becomes
available, the kernel adds a route to the immedialtely connected
network (which is determined by interface address and netmask).

So stopping an interface has the side effect of clearing ALL routes
going through this nterface, while starting an interface has only
the side effect of adding a route for the net that is locally
connected to this interface.
The kernel can not add the default route on its own again because
all information about this route had been deleted ehrn the interface
went down.

To add non-local routes (including the default route) you could now
run "/etc/rc.d/routing start"

Wolfgang


More information about the freebsd-stable mailing list