Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2012 05:22:15 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/164393: [rc.d] restarting netif with static addresses doesn't restart routing; makes machine unreachable
Message-ID:  <201201230522.q0N5MFWc096276@red.freebsd.org>
Resent-Message-ID: <201201230530.q0N5U9kC034221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         164393
>Category:       misc
>Synopsis:       [rc.d] restarting netif with static addresses doesn't restart routing; makes machine unreachable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 23 05:30:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.0-STABLE
>Organization:
n/a
>Environment:
FreeBSD bayonetta.local 9.0-STABLE FreeBSD 9.0-STABLE #4 r230371M: Thu Jan 19 23:55:38 PST 2012     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
If I set ifconfig_<interface> to something other than "DHCP", then run 'service netif restart', it doesn't automatically restart the routing service, and thus redo the default route. So, the machine is now potentially unreachable from outside the subnet.

This is a well-known caveat for seasoned FreeBSD users (it's been present ever since I started using it back in the 5.2 days), but it's an unexpected gotcha for FreeBSD newbies.

(more info on this is described here: http://forums.freebsd.org/showthread.php?t=12132 , and several Google searches pull up the same usability nit).

Example:

# egrep '^(ifconfig_re0|defaultrouter)=' /etc/rc.conf
ifconfig_re0="DHCP"
# service netif restart
Stopping Network: lo0 re0.

..

# netstat -nr | grep ^default
default            192.168.20.1       UGS         0        0    re0
# ping -c 1 google.com
PING google.com (74.125.224.82): 56 data bytes
64 bytes from 74.125.224.82: icmp_seq=0 ttl=55 time=16.834 ms

--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 16.834/16.834/16.834/0.000 ms

(Change the address to a static IP; specify the default gateway)

# egrep '^(ifconfig_re0|defaultrouter)=' /etc/rc.conf
defaultrouter="192.168.20.1"
ifconfig_re0="inet 192.168.20.2/24"
# service netif restart
Stopping Network: lo0 re0.

..

# netstat -nr | grep ^default
# ping -c 1 google.com
ping: cannot resolve google.com: Host name lookup failure
# ping -c 1 192.168.20.1
PING 192.168.20.1 (192.168.20.1): 56 data bytes
64 bytes from 192.168.20.1: icmp_seq=0 ttl=64 time=0.662 ms

--- 192.168.20.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.662/0.662/0.662/0.000 ms

The desired behavior would be that the machine would be able to reach outside the network, even after I've restarted the interface.
>How-To-Repeat:
1. Change an interface from DHCP to a defaultrouter/static IP configuration.
2. Restart the network interface via service netif restart
>Fix:
Please note that I'm not requesting that /etc/rc.d/routing be called from /etc/rc.d/netif . This is counterproductive to the way that things should be done. What I'm requesting is that an alternate mechanism for restarting network configuration be setup (sort of like /etc/netstart ) s.t. people who don't want to reinvent the wheel in terms of what /etc/rc.d/netif already does will have a mechanism that's easy to describe to non-FreeBSD savvy users, such that sysadmins won't need to have another machine on-hand to re-bootstrap the routing tables in the machine where the network was restarted.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201230522.q0N5MFWc096276>