Windows routing problem: Network is unreachable
I don’t know what got broken, or how did it get broken but IP connections on my interface which is using AUTO IP (169.254.0.0/16) stopped working all of a sudden.
$ nc -nvvvv 169.254.2.206 23 (UNKNOWN) [169.254.2.206] 23 (?) : Network is unreachable sent 0, rcvd 0
When I explicitly bind to the correct interface it worked.
$ nc -s 169.254.46.68 -nvvvv 169.254.2.206 23 (UNKNOWN) [169.254.2.206] 23 (?) open Welcome to ENDA Administration Terminal Password:
The fact that the error is returned immediately and the content of the error points out that it is a routing problem. So I checked my routing table.
$ route -4 print
===========================================================================
Interface List
37...00 1f 1f ea 7f 52 ......150Mbps Wireless 802.11b/g/n Nano USB Adapter
28...00 ff 2d 67 65 d4 ......TAP-Win32 Adapter V9
10...00 1d ba 68 a5 ac ......Intel(R) 82567LM Gigabit Network Connection
1...........................Software Loopback Interface 1
12...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
39...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
26...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
38...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.104 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
169.254.46.68 255.255.255.255 On-link 169.254.46.68 356
192.168.1.0 255.255.255.0 On-link 192.168.1.104 281
192.168.1.104 255.255.255.255 On-link 192.168.1.104 281
192.168.1.255 255.255.255.255 On-link 192.168.1.104 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 169.254.46.68 356
224.0.0.0 240.0.0.0 On-link 192.168.1.104 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 169.254.46.68 356
255.255.255.255 255.255.255.255 On-link 192.168.1.104 281
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
0.0.0.0 0.0.0.0 192.168.1.1 Default
0.0.0.0 0.0.0.0 192.168.1.1 Default
===========================================================================
Looks like the problem is
169.254.46.68 255.255.255.255 On-link 169.254.46.68 356
Netmask should have been 255.255.0.0, so that any 169.254.C.D would be carried on with this routing record. So I deleted the faulty line
route -4 delete 169.254.46.68
then issued
route -4 add 169.254.0.0 mask 255.255.0.0 0.0.0.0 metric 3 if 10
10 being my Ethernet adapter as can be seen on the top “route -4 print”. Tricky part for me was to get the gateway was “On-link” in the routing table, after a couple of tries I figured using “0.0.0.0″ as the gateway just makes it “On-link”. After all, whole point of AUTO IP networks is that there’s no router present :)
Now, it works, but after reboots these could be screwed up all over again (despite the fact that route has -p parameter). We’ll see.