Ubuntu sets a wrong routing table if the router is switched off and on again:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 wlan0
In order to get a correct route I have to manually delete the wlan connection and set it up fresh (as if I connect to that wlan the very first time); Ubuntu then asks me for the wlan password. And then I get the correct routing table:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
However, it doesn't keep that routing table correctly. How can I force Ubuntu to automatically choose the proper route without having to manually delete the wifi connection each time?