No ICMP Destination Host Unreachable when physically disconnected
Posted: Fri Dec 06, 2019 5:57 pm
I have a very simple two-machine vpn connected by a single ethernet cable. When the machines are connected, the vpn functions as expected. However if I unplug the ethernet cable from one of the machines, any process that tries to use the vpn hangs awfully. Some sleuthing with ping and tcpdump has revealed that the tun0 interface on either machine happily sends ICMP echo requests off into the void and never returns anything. My expectation (as exhibited by the physical network interfaces in this situation) would be to get an ICMP destination host unreachable code back in a matter of seconds. This would allow processes trying to use the network to get on with their lives.
So, the question. Why doesn't tun0 return host unreachable when the machines have been physically disconnected? Is there a setting I need to use to make this happen?
Here's a comparison of ping and tcpdump output for unreachable LAN and vpn addresses.
Physical ping (expected behavior):
Output from tcpdump:
VPN ping (problematic behavior):
tcpdump output:
So, the question. Why doesn't tun0 return host unreachable when the machines have been physically disconnected? Is there a setting I need to use to make this happen?
server.conf
port [port]
proto udp
tls-server
dev tun
ca [location]
cert [location]
key [location]
askpass [location]
dh [location]
server [address] [netmask]
ifconfig-pool-persist ipp.txt
client-config-dir [location]
client-to-client
keepalive 10 120
tls-auth [location]
cipher AES-256-CBC
tls-version-min 1.2
auth SHA512
auth-nocache
user nobody
group nobody
persist-key
persist-tun
status [location]
log-append [location]
writepid [location]
verb 5
explicit-exit-notify 1
proto udp
tls-server
dev tun
ca [location]
cert [location]
key [location]
askpass [location]
dh [location]
server [address] [netmask]
ifconfig-pool-persist ipp.txt
client-config-dir [location]
client-to-client
keepalive 10 120
tls-auth [location]
cipher AES-256-CBC
tls-version-min 1.2
auth SHA512
auth-nocache
user nobody
group nobody
persist-key
persist-tun
status [location]
log-append [location]
writepid [location]
verb 5
explicit-exit-notify 1
client.conf
client
dev tun
proto udp
tls-client
remote [server ip] [server port]
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
ca [location]
cert [location]
key [location]
askpass [location]
remote-cert-tls server
tls-auth [location]
cipher AES-256-CBC
tls-version-min 1.2
auth SHA512
auth-nocache
log-append [location]
writepid [location]
verb 5
dev tun
proto udp
tls-client
remote [server ip] [server port]
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
ca [location]
cert [location]
key [location]
askpass [location]
remote-cert-tls server
tls-auth [location]
cipher AES-256-CBC
tls-version-min 1.2
auth SHA512
auth-nocache
log-append [location]
writepid [location]
verb 5
Here's a comparison of ping and tcpdump output for unreachable LAN and vpn addresses.
Physical ping (expected behavior):
Code: Select all
PING X.X.X.X (X.X.X.X) 56(84) bytes of data.
From Y.Y.Y.Y icmp_seq=2 Destination Host Unreachable
From Y.Y.Y.Y icmp_seq=3 Destination Host Unreachable
From Y.Y.Y.Y icmp_seq=4 Destination Host Unreachable
# Ctrl^C here, note host unreachable
--- X.X.X.X ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5704ms
pipe 3
Code: Select all
# No output
Code: Select all
PING X.X.X.X (X.X.X.X) 56(84) bytes of data.
# Ctrl^C here, note no output
--- X.X.X.X ping statistics ---
9 packets transmitted, 0 received, 100% packet loss, time 8393ms
Code: Select all
10:35:53.143517 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 21800, seq 1, length 64
10:35:53.830677 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 22297, seq 5565, length 64
10:35:54.142666 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 21800, seq 2, length 64
10:35:54.830766 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 22297, seq 5566, length 64
10:35:55.142717 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 21800, seq 3, length 64
10:35:55.830729 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 22297, seq 5567, length 64
10:35:56.142698 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 21800, seq 4, length 64
10:35:56.830686 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 22297, seq 5568, length 64
10:35:57.142676 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
Y.Y.Y.Y > X.X.X.X: ICMP echo request, id 21800, seq 5, length 64
# ICMP echo reply and ICMP host unreachable are never returned