RPI ssh connection over ethernet is lost when wlan0 is not connected AND set to a static IP
Steps to reproduce:
1. Login to pi via ssh (eth0)
2. $ sudo ifconfig wlan0 192.168.10.24 (edit: same range as eth0 ip, but not the same)
3. verify that ssh locks up.
4. on a terminal on the pi:
4a. $ping 184.108.40.206 (ok)
4b. $ping www.google.com (fails)
4c. route (hangs)
4d. sudo ifconfig wlan0 0 (on a terminal on the pi)
5. ssh session continues
6. $ route (works)
Just me, or anyone experienced the same?
It seems that 'ifconfig address x' adds -as a side effect- a new entry with 'metric 0' in the routing table, while the default metric is 202. Hence, the new entry acquires priority over the eth0 route.
Setting the static ip using 'ip address add dev wlan0 192.168.10.24' does not have this side effect.
Actually the equivalent iproute2 command is 'ip address add dev wlan0 192.168.10.24/24', which does change the routing table, however using 'ip address add dev wlan0 192.168.10.24/24 noprefixroute' prevents this.
Linux raspberrypi 4.14.50-v7+ #1122 SMP Tue Jun 19 12:26:26 BST 2018 armv7l GNU/Linux
/boot/cmdline: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=bae958df-02 rootfstype=ext4 elevator=deadline fsck.repair=yes ipv6.disable=1 rootwait
systemd-resolved: inactive (using resolvconf for /etc/resolv.conf, nameserver set by dhcpcd)
Revision: a020d3 (RPI 3B+)