Hi,
I have the following static routes setup on my laptop.
em0 is a lan connection to my router 172.26.153.1.
tun1 is sometimes used by a ssh tunnel to the same router.
It is now down.
The routing table is attached below.
Now I'm wondering why the first ping seems to use the 172.26.153/24
route via 172.26.153.18 (which is currently not up and has priority 10)
instead of the default route via 172.26.153.1 which has a higher
priority and is up.
The funny thing is that adding another route to 172.26.153/24 via
gateway 172.26.153.1 fixes this problem and allows the ping to
happen.
Why is this route used while the default route is ignored, although it
looks exactly the same (same priority) except having a larger subnet (0/0)??
Are more specific routes somehow preferred?
Any help, especially hints towards helpful documentation, are very
welcome.
Christopher
$ ifconfig tun1
tun1: flags=51<UP,POINTOPOINT,RUNNING> mtu 1500
priority: 0
groups: tun
status: down
inet 172.26.153.19 --> 172.26.153.18 netmask 0xffffffff
$ route -n show -inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Prio Iface
default 172.26.153.1 UGS 29 659 - 8 em0
default 172.26.153.18 GS 0 0 - 10 tun1
127/8 127.0.0.1 UGRS 0 0 33152 8 lo0
127.0.0.1 127.0.0.1 UH 2 0 33152 4 lo0
172.26.153.0/28 link#1 UC 1 0 - 4 em0
172.26.153/24 172.26.153.18 GS 0 2 - 10 tun1
172.26.153.1 00:0d:b9:24:60:40 UHLc 4 58 - 4 em0
172.26.153.7 127.0.0.1 UG 0 0 33152 56 lo0
172.26.153.18 172.26.153.19 H 2 0 - 4 tun1
224/4 127.0.0.1 URS 0 0 33152 8 lo0
$ ping -c 1 -i 1 phone
PING phone.gmerlin.de (172.26.153.17): 56 data bytes
ping: sendto: Host is down
ping: wrote phone.gmerlin.de 64 chars, ret=-1
--- phone.gmerlin.de ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
$ sudo route add 172.26.153/24 172.26.153.1
add net 172.26.153/24: gateway 172.26.153.1
$ route -n show -inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Prio Iface
default 172.26.153.1 UGS 13 659 - 8 em0
default 172.26.153.18 GS 0 0 - 10 tun1
127/8 127.0.0.1 UGRS 0 0 33152 8 lo0
127.0.0.1 127.0.0.1 UH 2 0 33152 4 lo0
172.26.153.0/28 link#1 UC 1 0 - 4 em0
172.26.153/24 172.26.153.1 UGS 0 0 - 8 em0
172.26.153/24 172.26.153.18 GS 0 3 - 10 tun1
172.26.153.1 00:0d:b9:24:60:40 UHLc 6 87 - 4 em0
172.26.153.7 127.0.0.1 UG 0 0 33152 56 lo0
172.26.153.18 172.26.153.19 H 2 0 - 4 tun1
224/4 127.0.0.1 URS 0 0 33152 8 lo0
$ ping -c 1 -i 1 phone
PING phone.gmerlin.de (172.26.153.17): 56 data bytes
64 bytes from 172.26.153.17: icmp_seq=0 ttl=127 time=1.071 ms
--- phone.gmerlin.de ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.071/1.071/1.071/0.000 ms