# routed announcements disrupts ongoing ping



## anarro (May 3, 2021)

After installing a 2nd FreeBSD server in the same network, I noticed a strange ping behavior as can be seen below.

Server1's IP is 200.23.130.28/25

```
# uname -a
FreeBSD tam 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC  i386
```
...with `gateway_enable="YES"` and `routed_enable="YES"` in /etc/rc.conf

Server2's IP is 200.23.130.22/25

```
# uname -a
FreeBSD felix 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC  i386
```
...with `gateway_enable="NO"` and `routed_enable="NO"` in /etc/rc.conf

This is output for ping from Server2:

```
# ping 200.23.130.28
PING 200.23.130.28 (200.23.130.28): 56 data bytes
64 bytes from 200.23.130.28: icmp_seq=0 ttl=64 time=0.173 ms
64 bytes from 200.23.130.28: icmp_seq=1 ttl=64 time=0.157 ms
64 bytes from 200.23.130.28: icmp_seq=2 ttl=64 time=0.175 ms
64 bytes from 200.23.130.28: icmp_seq=3 ttl=64 time=0.157 ms
64 bytes from 200.23.130.28: icmp_seq=4 ttl=64 time=0.149 ms
64 bytes from 200.23.130.28: icmp_seq=5 ttl=64 time=0.150 ms
64 bytes from 200.23.130.28: icmp_seq=6 ttl=64 time=0.149 ms
64 bytes from 200.23.130.28: icmp_seq=7 ttl=64 time=0.146 ms
64 bytes from 200.23.130.28: icmp_seq=8 ttl=64 time=0.161 ms
ping: recvmsg: Bad address
ping: recvmsg: Bad address
ping: recvmsg: Bad address
ping: recvmsg: Bad address
^C
--- 200.23.130.28 ping statistics ---
13 packets transmitted, 9 packets received, 30.8% packet loss
round-trip min/avg/max/stddev = 0.146/0.157/0.175/0.010 ms
```
...with a random number of successful pings previous to an error, but mostly icmp_seq<30.

BUT...  with Verbose option we can see that disruption occurs when a routing advertising is received:

```
# ping -v 200.23.130.28
PING 200.23.130.28 (200.23.130.28): 56 data bytes
64 bytes from 200.23.130.28: icmp_seq=0 ttl=64 time=0.165 ms
64 bytes from 200.23.130.28: icmp_seq=1 ttl=64 time=0.156 ms
64 bytes from 200.23.130.28: icmp_seq=2 ttl=64 time=0.155 ms
16 bytes from 200.23.130.28: Router Advertisement

ping: recvmsg: Bad address
ping: recvmsg: Bad address
^C
--- 200.23.130.28 ping statistics ---
5 packets transmitted, 3 packets received, 40.0% packet loss
round-trip min/avg/max/stddev = 0.155/0.159/0.165/0.005 ms
```
UNLESS... -R record route option is active:

```
# ping -Rv 200.23.130.28
PING 200.23.130.28 (200.23.130.28): 56 data bytes
64 bytes from 200.23.130.28: icmp_seq=0 ttl=64 time=0.173 ms
RR:     200.23.130.28
        200.23.130.22
64 bytes from 200.23.130.28: icmp_seq=1 ttl=64 time=0.171 ms    (same route)
16 bytes from 200.23.130.28: Router Advertisement

64 bytes from 200.23.130.28: icmp_seq=2 ttl=64 time=0.153 ms    (same route)
64 bytes from 200.23.130.28: icmp_seq=3 ttl=64 time=0.163 ms    (same route)
64 bytes from 200.23.130.28: icmp_seq=4 ttl=64 time=0.164 ms    (same route)
64 bytes from 200.23.130.28: icmp_seq=5 ttl=64 time=0.157 ms    (same route)
64 bytes from 200.23.130.28: icmp_seq=6 ttl=64 time=0.152 ms    (same route)
^C
--- 200.23.130.28 ping statistics ---
7 packets transmitted, 7 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.152/0.162/0.173/0.008 ms
```
NOW...  if routed is killed in Server1, no routing announcements are received and ping goes on well.
No strange behavior with ping6 was observed, but I didn't check if routing announcements are being sent over IPV6.

My network has shown some service intermittencies that could be related to this situation, but I have not yet pinpointed.

Any ideas on what is going on here?
Thanks


----------



## SirDice (May 4, 2021)

Why are you enabling routing and routed(8) if there's nothing to route? Routing is done between two or more interface, both hosts appear to have only one. So there's no need to enable routing. Also note that RIP (what routed(8) uses) only does class subnets, 200.23.130.x is a class C subnet, so it always assumes a subnet mask of 255.255.255.0, not 255.255.255.128. You really shouldn't use routed(8) anymore, the routing protocols are ancient, nobody uses RIP any more. OSPF and BGP are used nowadays. 



anarro said:


> No strange behavior with ping6 was observed, but I didn't check if routing announcements are being sent over IPV6.


routed(8) and `gateway_enable` work for IPv4 only.


----------



## anarro (May 5, 2021)

Server1 hosts 2 OpenVPN links plus two ethernet links (one is temporarily down). I decided on using RIP v2 due to the simplicity of my network and the fact that there is one ancient device that does not support other tan RIP. And yes, I will upgrade to OSPF.

Anyway, routed is still supported, and there might be an issue here.

Thanks!


----------



## SirDice (May 5, 2021)

anarro said:


> I decided on using RIP v2 due to the simplicity of my network


Like I said, 200.x.x.x is a class C network, thus a /24 netmask is assumed here, not the /25 you have. Having the wrong subnet mask can lead to really weird routing issues.

I would check your network for ICMP redirects, as those are likely the reason why your routing gets messed up. You should ignore those for security reasons.


----------

