My PC (Ubuntu 16.04) is connected to the home network by an Ethernet cable. I want to move to another room and use Wifi. I want to switch over as seamlessly as possible (to avoid VPN disconnection, for instance). I can connect to both the Wifi and Ethernet, but if at that point I disconnect the Ethernet applications receive a connection error.
So I think I need a way to force the traffic to use the Wifi interface before disconnecting the wire. With both interfaces active, ip route says:
default via 192.168.0.254 dev enp0s31f6 proto static metric 100
default via 192.168.0.254 dev wlp4s0 proto static metric 600
192.168.0.0/24 dev enp0s31f6 proto kernel scope link src 192.168.0.43 metric 100
192.168.0.0/24 dev wlp4s0 proto kernel scope link src 192.168.0.7 metric 600
If I use:
ip route del default via 192.168.0.254 dev enp0s31f6
traffic goes to a crawl.
So I think I have to be a bit more subtle and keep both interfaces active for a while, but make the Wifi one the preferred one. I believe this is accomplished by having a smaller metric on the Wifi interface than on the Ethernet one. However, if I do:
ip route change default via 192.168.0.254 dev enp0s31f6 proto static metric 600
I get:
default via 192.168.0.254 dev enp0s31f6 proto static metric 100
default via 192.168.0.254 dev enp0s31f6 proto static metric 600
So the command seems to replace whatever interface has the given metric. And if I try to use any other metric value than 100 or 600, I get:
RTNETLINK answers: No such file or directory
Of course, if I am on Wifi and reconnect to the Ethernet, the traffic switches seamlessly to it...
So, which of my assumptions are wrong? Is there a solution?