I have OpenBSD 5.9 on a virtual private server. Like other people in these days of No More IPv4 Address Space For You, the machine is allocated only a /32, i.e. a LAN of just a single IPv4 address. The (sole) other node on the LAN is the default gateway to the world supplied by the hosting provider. It's in effect a LAN of two nodes, but without IP broadcasting.
The way to address this is fairly straightfoward and well known. Set up the default route as normal, and create a static route over the LAN network interface in order to reach the default gateway itself. The latter is done in my
/etc/hostname.vio0 with the following line
!route add 184.108.40.206 -static -link -iface vio0
Unfortunately, this does not work. The machine regularly loses connectivity to the entire world.
I find that, after a day or two, the static route via the interface has disappeared entirely from the routing table, seemingly at random, at no particularly regular time of day. After adding it back, it will disappear again. Checking, there are no cron jobs or other scheduled tasks that could be triggering it, and it isn't happening aligned to a minute boundary anyway. Moreover, the machine is largely idle most of the times that this happens.
route monitor piped through
cyclog to a log directory and leaving it running for days, in order to catch the problem when it happens, reveals that it is the kernel itself that is doing this, not some user process:
2016-07-29 06:27:08.436729680 got message of size 144 on Fri Jul 29 06:27:08 2016 2016-07-29 06:27:08.436740030 RTM_DELETE: Delete Route: len 144, priority 0, table 0, ifidx 1, pid: 0, seq 0, errno 0 2016-07-29 06:27:08.436747000 flags: 2016-07-29 06:27:08.436752930 use: 0 mtu: 0 expire: 0 2016-07-29 06:27:08.436759100 locks: inits: 2016-07-29 06:27:08.436764620 sockaddrs: 2016-07-29 06:27:08.436770290 220.127.116.11 link#1
Why is the OpenBSD kernel doing this? And how do I stop it?