service netif restart && service routing restart removes default route for gateway received via dhclient

Hi,

I have a FreeBSD server running 14.0. It's primary network interface receives public IP and default route via dhclient.

Sometimes after fiddling with static routes in fib 1 and adding these to rc.conf I need to run:
Code:
service netif restart
service routing restart

This however removes the default route from the ISP received via the DHCP.

If running service netif restartagain re-runs dhclient and default route is received.

My problem with this is that it feels the wrong way of having to run service netif restart twice -- what is the correct way of handling this?
 
When messing with networking I often ignore the service and work on the process level.
pkill dhclient
dhclient ${interface_name}
 
Hi,

I have a FreeBSD server running 14.0. It's primary network interface receives public IP and default route via dhclient.

Sometimes after fiddling with static routes in fib 1 and adding these to rc.conf I need to run:
Code:
service netif restart
service routing restart

This however removes the default route from the ISP received via the DHCP.

If running service netif restartagain re-runs dhclient and default route is received.

My problem with this is that it feels the wrong way of having to run service netif restart twice -- what is the correct way of handling this?
I suggest filing a bug report. But first think through what you think should be done and propose that!
 
Well you could try something like this instead if local:

service routing stop
service netif restart
service routing start
When messing with networking I often ignore the service and work on the process level.
pkill dhclient
dhclient ${interface_name}
Thanks for your pragmatic input!


I can't help with that specifically (sorry). Try an adaptation of the verbose command at <https://forums.freebsd.org/posts/633113>.
Interesting to see that I am not the only one to struggle with something similar.

I suggest filing a bug report. But first think through what you think should be done and propose that!
At the moment I am a little bit unsure whether there is a bug. This was the first time anything like this happened -- server is on UPS and there were a small power outage while I had an external USB-HDD connected that were separately powered and dmesg did indicate some error messages so maybe that was related?
 
For DHCP interfaces I typically use service dhclient restart, or for a specific interface; service dhclient restart em0

/etc/rc.d/netif and /etc/rc.d/routing only deal with static addresses and routes.
 
Waking up from a sleep state is an entirely different issue. I meant the workings of netif, routing and dhclient scripts. How and why they work is predictable.
 
An outcome of service routing restart:

Code:
root@mowa219-gjp4-zbook-freebsd:~ # route show default
route: route has not been found
 
IMHO a DHCP'ed interface should always be restarted on resume by default. Or may be after pinging the nexthop once/twice. If it fails then do a netif restart. Similarly any time an ethernet cable is detached and reconnected, you may have moved your laptop to a different place. Though, this is much less likely now. Perhaps a ping on resume should always be done and for ports with fixed ip address a ping failure should be an alert.

These kind of relatively small changes can help improve the user experience (but one has to be careful about unintended consequences as well).
 
service netif restart brings up and down all network interfaces.

service routing restart clears routing table and adds only routes configured in /etc/rc.conf, correct?
 
What, if anything, was wrong with this?

date ; uptime ; ifconfig wlan0 down ; ifconfig em0 up ; sleep 10 ; service routing restart ; sleep 10 ; service dhclient restart em0 ; sleep 10 ; route show default ; ping -c 2 -4 freshports.org

Run at 09:32 this morning. em0 was physically connected. I didn't get an Internet connection.
 
Show us the output. Also add the output of "route show default" before everything else, assuming you had a working setup before the above test.
 
Show us the output.

Not really appropriate, this is FreeBSD-CURRENT (I can't seek technical support here).

All I need to know is whether anything is obviously wrong with the command.

… assuming you had a working setup before the above test.

I did. Much the same as a few days ago (above): Sleep the computer at home, un-dock, dock it at work. At home, I had an Internet connection.
 
Back
Top