issue with next hop using freebsd loopback?

Benoit Chesneau benoitc at enki-multimedia.eu
Fri Jun 16 09:49:45 CEST 2023


I first posted this issue on the freebsd ml but it's probably more an issue to post there. 

I have  the loopbacks `1.1.1.1`  and `1.1.1.2` of 2 nodes distributed using OSPF:
```
filter ospfexport {        if (source = RTS_DEVICE) then accept;
        reject;

}


protocol ospf v2 { tick 2;
 ipv4 {
        import all;
        export filter ospfexport;

 };
 area 0 {
  stub no;
  interface "vlan1", "vlan2" {
   type ptp;
   cost 5;
  };
  interface "lo1" { stub; };
 };
}

```

`1.1.1.1` is set on the loopback:

```# ifconfig lo1lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo1 prefixlen 64 scopeid 0x9
inet 1.1.1.1 netmask 0xffffffff
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
# birdc show route for 1.1.1.1BIRD 2.13 ready.
Table master4:
1.1.1.1/32      unicast [ospf1 15:56:43.054] ! I (150/0) [1.1.1.1]
dev lo1
```

The distribution works OK and I can ping each others:

```
# route -n get 1.1.1.2   route to: 1.1.1.2
destination: 1.1.1.2
    gateway: 10.3.1.1
        fib: 0
  interface: vlan2212
      flags: <UP,GATEWAY,HOST,DONE,PROTO1>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      9000         1         0
```

But the IP of the loopback can't be used as BGP  next hop in the following configuration:

```protocol bgp rr_par_ipv4 {        local 1.1.1.1 as 65001;
        neighbor 1.1.1.1.2 as 65001;
        default bgp_local_pref 40;
        rr client;
        ipv4 {
                import all;
                export all;
                next hop self;
        };
};
```

The source IP used as next hop is not 1.1.1.1 but the IP `10.3.1.2` of vlan1 used for the connection between 2 nodes:

```
# ifconfig vlan1vlan2212: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
options=680703<RXCSUM,TXCSUM,TSO4,TSO6,LRO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
ether 50:65:f3:8b:98:71
inet 10.3.1.2 netmask 0xffffff00 broadcast 10.3.1.255
inet6 fe80::5265:f3ff:fe8b:9871%vlan2212 prefixlen 64 scopeid 0xd
groups: vlan
vlan: 20 vlanproto: 802.1q vlanpcp: 0 parent interface: mlxen0
media: Ethernet autoselect (40Gbase-CR4 <full-duplex,rxpause,txpause>)
status: active
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
```

**Even if I force the next hop address (using `next hop address`) it still take the IP of the vlan. What's wrong?***

```
$ bird --versionBIRD version 2.13
$ uname -nmr
myhostname 13.2-RELEASE amd64
``` 

Benoît



More information about the Bird-users mailing list