Bug 164393 - restarting netif with static addresses doesn't restart routing; makes machine unreachable
Summary: restarting netif with static addresses doesn't restart routing; makes machine...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-23 05:30 UTC by Enji Cooper
Modified: 2024-12-14 02:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2012-01-23 05:30:09 UTC
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.

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.
How-To-Repeat: 1. Change an interface from DHCP to a defaultrouter/static IP configuration.
2. Restart the network interface via service netif restart
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-01-23 05:44:41 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

reclassify.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:48 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped