dhcp packet causes invalid mac address for host in arp cache, in virtualbox on natnetwork, can't ssh host/cifs
Unsure if this affects alpine only or in general to busybox
Its not clear to me what OS should do when a host and DHCP server share an ip-address but have different MAC-address. Fedora/gparted seems resilient to this issue as it has not be encountered before with them
Setup
- alpine-3.12 guest in Virtualbox-6.10 in Win 10 (2020.4) host
- VBOX-emulated NAT (10.1.WW.x) with VBOX emulated NAT services, (1 eth0). This is not the "NAT" adapter but the "NATNetwork" adaptor. The "NAT Network" name is "NatNetworkWW". Then "NatNetworkWW" is configured for host forwarding in VBOX common tools preferences/network.
- smb/cifs shared folder from host, mounted using cifs-utils in alpine
- VBOX emulated network card (intel-pro/virtio-net) does not matter
- kernel linux-lts/linux-virt does not matter
Symptom
Guest terminal is accessed via VBOX GUI.
- ssh to host from inside guest stops working. Also, new ssh connections cannot be made.
- CIFS/SMB df command, freezes for ~2min on the line of cifs-mount, omits/skips line of the mount
- ls /mnt/sharedir command freeze for ~2min without output
- The invalid arp entry uses a Virtualbox internal MAC address 08:00:27.x.y.z, hinting at a VBOX service such as DHCP-server
Virtualbox, by default, emulates a gateway on 10.1.WW.1, host on 10.1.WW.2, dhcp-server on 10.1.WW.2, first issued IP address is 10.1.WW.15
Resolution
- one way resolve the problem is to issue "arp -d 10.1.WW.2" and retry commands/connection. After the entry is purged, the issue is temporarily resolved. The spoilt arp/issue reappears within a few minutes.
- final resolution: The solution was to modify C:\Users\Admin\.Virtualbox\Virtualbox.xml and change the emulated DHCP address from 10.1.WW.2 to a different IP 10.1.WW.5 and the DHCP range lower-IP-setting to 10.1.WW.15
debug logs when ssh to host/smb working
# # notice that below the arp MAC-Adresses are the same
# arp -a
zzzhost (10.1.WW.2) at 52:XX:54:XX:35:00 [ether] on eth0
? (10.1.WW.1) at 52:XX:54:XX:35:00 [ether] on eth0
# ip route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.1.WW.1 0.0.0.0 UG 202 0 0 eth0
10.1.WW.0 * 255.255.255.0 U 0 0 0 eth0
# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether ZZ:ZZ:9c:b5:2c:14 brd ff:ff:ff:ff:ff:ff
inet 10.1.WW.15/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::13:9cff:feb5:xxxx/64 scope link
valid_lft forever preferred_lft forever
debug logs when ssh to host/smb NOT working
# # notice the spurious MAC-Adress for host
zzzhost (10.1.WW.2) at 08:00:27:f9:07:98 [ether] on eth0
? (10.1.WW.1) at 52:XX:54:XX:35:00 [ether] on eth0
# ip route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.1.WW.1 0.0.0.0 UG 202 0 0 eth0
10.1.WW.0 * 255.255.255.0 U 0 0 0 eth0
# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether ZZ:ZZ:9c:b5:2c:14 brd ff:ff:ff:ff:ff:ff
inet 10.1.WW.15/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::13:9cff:feb5:xxxx/64 scope link
valid_lft forever preferred_lft forever
debug logs after resolution
notice the the dhcp-server mac has its own ip-address 10.1.WW.5
# arp -a
? (10.1.WW.1) at 52:XX:54:XX:35:00 [ether] on eth0
? (10.1.WW.5) at 08:00:27:9e:52:85 [ether] on eth0
zzzhost (10.1.WW.2) at 52:XX:54:XX:35:00 [ether] on eth0
- on boot/login, MAC entry for zzzhost 10.1.WW.2 exists from the beginning
- the MAC entry for gateway 10.1.WW.1 appears after a wget of any webpage
- the MAC entry for dhcpserver 10.1.WW.5 appears after a few minutes
- CIFS/ssh is unaffected no matter the uptime
Also created vbox ticket https://www.virtualbox.org/ticket/19675