Re: Loss of default route

From: Doug Hardie <bc979_at_lafn.org>
Date: Thu, 13 Feb 2025 18:46:43 UTC
> On Feb 13, 2025, at 03:18, Frank Leonhardt <freebsd-doc@fjl.co.uk> wrote:
> 
> On 13/02/2025 08:35, Doug Hardie wrote:
>> I am setting up a new server and anytime that "service" is run, it deletes the default route.  I don't have this problem on any other server.  Using 14.2-RELEASE.  The network interface has a fixed IP address.  There are no indications in messages of issues with the network interface. Even a service xxx stop where xxx does not exist removes the default route.
>> 
>> root@checkout:/home/doug # netstat -rn
>> Routing tables
>> 
>> Internet:
>> Destination        Gateway            Flags         Netif Expire
>> default            10.0.1.1           UGS             ue0
>> 10.0.0.0/16        link#2             U               ue0
>> 10.0.1.212         link#1             UHS             lo0
>> 127.0.0.1          link#1             UH              lo0
>> 
>> root@checkout:/home/doug # service ntp stop
>> ntp does not exist in /etc/rc.d or the local startup
>> directories (/usr/local/etc/rc.d), or is not executable
>> root@checkout:/home/doug # !net
>> netstat -rn
>> Routing tables
>> 
>> Internet:
>> Destination        Gateway            Flags         Netif Expire
>> 10.0.0.0/16        link#2             U               ue0
>> 10.0.1.212         link#1             UHS             lo0
>> 127.0.0.1          link#1             UH              lo0
>> 
>> 
>> /etc/rc.conf includes:
>> defaultrouter="10.0.1.1"
>> 
>> If I kill ntpd manually and then start it manually without service, the default route remains and ntpd finds its peers.
>> 
>> -- Doug
> 
> I have a clean install of 14.2-RELEASE I'm using for testing ZFS, so I've just tried to recreate this and couldn't. And I tried quite hard!
> 
> You know defaultroute is kind of like a service in rc.d ? (Not that this helps but it might be relevant).
> 
> If you post some key files I can try those for you. Anything varying from a clean install. My bet is on something in rc.conf is a bit off and triggering a bug.
> 
> Regards, Frank.
> 


It gets even more interesting.  I only need to run service with no arguments to delete the default route:

root@checkout:/home/doug # !net
netstat -rn4
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            10.0.1.1           UGS             ue0
10.0.0.0/16        link#2             U               ue0
10.0.1.212         link#1             UHS             lo0
127.0.0.1          link#1             UH              lo0
root@checkout:/home/doug # service

Usage:
service [-j <jail name or id>] -e
service [-j <jail name or id>] -R
service [-j <jail name or id>] [-v] -l | -r
service [-j <jail name or id>] [-v] [-E var=value] <rc.d script> start|stop|etc.
service -h

-j		Perform actions within the named jail
-E n=val	Set variable n to val before executing the rc.d script
-e		Show services that are enabled
-R		Stop and start enabled /usr/local/etc/rc.d services
-l		List all scripts in /etc/rc.d and /usr/local/etc/rc.d
-r		Show the results of boot time rcorder
-v		Verbose

root@checkout:/home/doug # !net
netstat -rn4
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
10.0.0.0/16        link#2             U               ue0
10.0.1.212         link#1             UHS             lo0
127.0.0.1          link#1             UH              lo0
root@checkout:/home/doug # 


Here is /etc/rc.conf.  My first thought was there had to be a problem there, but I am not finding one.  Running service -v shows that it finds the proper default route.

### FSCK Options ###
fsck_y_enable="YES"
background_fsck="NO"
clear_tmp_enable="YES"

### Basic Network Options ###
hostname="checkout"

### IPv4 Setup ###
ifconfig ue0 inet 10.0.1.212/16
defaultrouter="10.0.1.1"

### Network Daemon Options ###
sshd_enable="YES"

### Network Time Services Options ###
ntpd_enable="YES"
ntpd_config="/etc/ntp.conf"
ntpd_sync_on_start="YES"

###############################################################
### Miscellaneous administrative options ######################
###############################################################
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
growfs_enable="YES"
dumpdev="AUTO"
powerd_enable="YES"

###############################################################
### Port and Package optionw ##################################
###############################################################
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

-- Doug