Solved Network interface eth0 IP address is MISSING after reboot

Greetings,

I'm running into a strange issue that I'm hoping someone can point me in the right direction.
The following FreeBSD version is running on my VPS (Virtual Private Server)...

[carltonfsck@ssh ~]$ freebsd-version -k
13.5-RELEASE-p9
[carltonfsck@ssh ~]$

The VPS is allocated with five (5) IP addresses configured as eth0 & eth0_aliases as follows (note: the IP addresses have been changed for security, but the last octet is correct):

100.100.100.2
100.100.100.3
100.100.100.4
100.100.100.5
100.100.100.6

Last evening, I ran "freebsd-update fetch install" to install some security updates and rebooted.
Upon reboot, I noticed the following error in the console:

sshd error: Could not bind to 100.100.100.2

When I looked at ifconfig for the eth0 interface, the 100.100.100.2 is missing. If I attempt to change the eth0 IP to 100.100.100.2, it will not add it. Rather,
it will replace one of the aliases below...

[clartonfsck@ssh ~]$ ifconfig
eth0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4c00b8<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE,TXCSUM_IPV6>
ether 52:00:00:39:09:14
inet 100.100.100.3 netmask 0xfffffff8 broadcast 100.100.100.7
inet 100.100.100.4 netmask 0xfffffff8 broadcast 100.100.100.7
inet 100.100.100.5 netmask 0xfffffff8 broadcast 100.100.100.7
inet 100.100.100.6 netmask 0xfffffff8 broadcast 100.100.100.7
media: Ethernet autoselect (10Gbase-T <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
[carltonfsck@ssh ~]$


The rc.conf configuration file has not changed and interface eth0 is configured as follows....

--- /etc/rc.conf ---


ifconfig_vtnet0_name=eth0
defaultrouter="100.100.100.1"
ifconfig_eth0="inet 100.100.100.2 netmask 255.255.255.248"
ifconfig_eth0_alias0="inet 100.100.100.3 netmask 255.255.255.248"
ifconfig_eth0_alias1="inet 100.100.100.4 netmask 255.255.255.248"
ifconfig_eth0_alias2="inet 100.100.100.5 netmask 255.255.255.248"
ifconfig_eth0_alias3="inet 100.100.100.6 netmask 255.255.255.248"
ifconfig_eth0="-rxcsum -txcsum -lro -tso"
gateway_enable="YES"
natd_enable="YES"
natd_interface="eth0"
natd_flags="-dynamic -m"


Ran the command 'pciconf -lv' and it shows a network adapter present...

=0x0001
vendor = 'Red Hat, Inc.'
device = 'Virtio network device'
class = network
subclass = ethernet
virtio_pci1@pci0:0:4:0: class=0x010000 rev=0x00 hdr=0x00 vendor=0x1af4 device=0x1004 subvendor=0x1af4 subdevice


Also, ran the command 'dmesg|grep eth0' and it shows the following....

[carltonfsck@ssh ~]$ dmesg|grep eth0
vtnet0: changing name to 'eth0'
eth0: link state changed to UP
vtnet0: changing name to 'eth0'
eth0: link state changed to UP
vtnet0: changing name to 'eth0'
eth0: link state changed to UP
vtnet0: changing name to 'eth0'
eth0: link state changed to UP
vtnet0: changing name to 'eth0'
eth0: link state changed to UP
[carltonfsck@ssh ~]$



I'm not sure what's going on. I have rebooted a couple of times, tried bringing eth0 up/down but nothing. I reached out to my provider and although they said they did maintenance the night before, they did not change any VLANs or IPs, and they confirmed that my IP block of the five (5) IPs above is still the same.

What would cause this? How come ifconfig will not set 100.100.100.2 as the IP on the primary eth0 interface?

Any guidance or assistance would greatly be appreciated as this is a bizarre issue.


Thanks!

--Cf
 
Code:
ifconfig_eth0="inet 100.100.100.2 netmask 255.255.255.248"
ifconfig_eth0="-rxcsum -txcsum -lro -tso"

These two lines seem to be in conflict.
The second one is overwriting the first.
Perhaps you meant to use += instead of = for the second one?

If you have backups, maybe check if etcupdate(8) mangled it when it updated your /etc/rc.conf?
 
Code:
ifconfig_eth0="inet 100.100.100.2 netmask 255.255.255.248"
ifconfig_eth0="-rxcsum -txcsum -lro -tso"

These two lines seem to be in conflict.
The second one is overwriting the first.
Perhaps you meant to use += instead of = for the second one?

If you have backups, maybe check if etcupdate(8) mangled it when it updated your /etc/rc.conf?
That's EXACTLY what it was! The dual "ifconfig_eth0" lines! I had the 2nd line commented out a few lines after this (omitted). But for some reason I threw it back in there and didn't realize it. The whole point of that line is because I had an extremely slow download speed (different thread for that issue). So, changing those ethernet options via the CLI fixed it. I tried putting that line in rc.conf, but it (the one commented out) didn't work.

Thanks again!! I appreciate you. I'll be more careful next time.
 
This doesn't work for rc.conf. Keep in mind that rc.conf is essentially a shell script that only contains variable assignments. += is a syntax error.

I was reminded of this script, which I occasionally remember to run to check for my own mistakes:

sh:
#!/bin/sh
# I can't remember if I (putney) wrote this or I got it from somewhere

cat /etc/rc.conf |
awk -F= '{
  if ( $0 ~ /^ *#/ ) {
    next
  }
  if (substr($1,1,1) !~ /^#/ && $1 !~ /^ *$/) {
    if ( $1 !~ /^[a-zA-Z0-9_]+$/ ) {
       print "Line " NR " not an assignment? :- " $1 "=" $2
    }
    n=split($2,a,"\"")
    m=split(a[3],b," *#")
    if( n!=3 ||  a[1] !="" || (a[3] !="" && b[2]=="")) {
       print "Line " NR " RHS not a string literal? :- " $2
    }
    if ( (frst[$1]+=1) != 1 ) {
      print "Line " NR " repeated assignment to variable " $1
    }
  }
}'
 
--- /etc/rc.conf ---


ifconfig_eth0="inet 100.100.100.2 netmask 255.255.255.248"
ifconfig_eth0_alias0="inet 100.100.100.3 netmask 255.255.255.248"
ifconfig_eth0_alias1="inet 100.100.100.4 netmask 255.255.255.248"
ifconfig_eth0_alias2="inet 100.100.100.5 netmask 255.255.255.248"
ifconfig_eth0_alias3="inet 100.100.100.6 netmask 255.255.255.248"
ifconfig_eth0="-rxcsum -txcsum -lro -tso"
Just a note - if you need disable the checksums as indicated with the second ifconfig_eth0 line, simply change it to another alias, ifconfig_eth0_alias4. The whole thing means those lines are all executed on eth0 interface in order described, nothing else. (Check boot sequence scripts for details if interested.)
 
Back
Top