Using "/etc/rc.d/netif start"

Nerius Landys nlandys at gmail.com
Tue Mar 29 17:40:21 UTC 2011


First off, I'm on 9.0-CURRENT-i386, but I don't think that will make a
difference for purposes of my question.  I think the freebsd-current
folks are expecting questions that are much harder than this one.

I'm trying to use /etc/rc.d/netif to bring down and bring back up all
network interfaces, because I'm trying to get the correct entries in
/etc/rc.conf for testing some extra network cards.

So right now, my /etc/rc.conf looks like this:

defaultrouter="192.168.0.254"
hostname="elmer.i"
ifconfig_em0="inet 192.168.0.6 netmask 255.255.255.0"

/etc/resolv.conf looks like this:

domain  i
nameserver      192.168.0.254

I'm basically in a LAN.  When I boot up this "elmer.i" machine,
everything works well.

Then, I do the following two commands:

  /etc/rc.d/netif stop
  /etc/rc.d/netif start

After these, I'm still able to ping a raw IP LAN address such as
192.168.0.254.  However, two problems start occurring:

1. I cannot ping an IP address that is outside of my LAN, e.g.
> ping 64.156.192.169
PING 64.156.192.169 (64.156.192.169): 56 data bytes
ping: sendto: No route to host

2. DNS (via 192.168.0.254 nameserver) won't work at first, but starts
to magically work when I for example enable sshd and log in to elmer
from another host on the LAN


So the nut of my question is, I think "/etc/rc.d/netif stop" stops
some additional things such as packet routing that the corresponding
"/etc/rc.d/netif start" command won't start back up.  So what is the
best way to bring down the network and bring it back up again for
purposes of testing /etc/rc.conf syntax?


More information about the freebsd-questions mailing list