When trying to find why my ospf configs were not sending the correct costing from Linux -> Cisco devices, I found some useful commands that I thought I would note down for future reference.
Linux – Using vtysh
My ospfd.conf looks something like this:
[root@dhcptst1 ~]# cat /etc/frr/ospfd.conf
hostname anycastrouter
!
log file /var/log/frr/ospfd.log
!
interface dhcp
ip ospf cost 10000 138.80.255.102
ip ospf cost 10010 138.80.255.202
!
interface ens192
ip ospf priority 0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 ...
!
router ospf
router-id 138.80.232.139
passive-interface default
no passive-interface ens192
log-adjacency-changes
network 138.80.232.128/26 area 0.0.0.0
network 138.80.255.102/32 area 0.0.0.0
network 138.80.255.202/32 area 0.0.0.0
distribute-list ANYCAST out connected
!
access-list ANYCAST permit 138.80.255.0/24
!
line vty
!
You can see the costs on linux using the vtysh
command:
root@dhcptst1 ~# vtysh
Hello, this is FRRouting (version 7.0).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
dhcptst1.cdu.edu.au# show ip ospf interface
dhcp is up
ifindex 3, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,NOARP>
This interface is UNNUMBERED, Area 0.0.0.0
MTU mismatch detection: enabled
Router ID 138.80.232.139, Network Type BROADCAST, Cost: 10000
Transmit Delay is 1 sec, State DR, Priority 1
No backup designated router on this network
Multicast group memberships: <None>
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
No Hellos (Passive interface)
Neighbor Count is 0, Adjacent neighbor count is 0
This interface is UNNUMBERED, Area 0.0.0.0
MTU mismatch detection: enabled
Router ID 138.80.232.139, Network Type BROADCAST, Cost: 10010
Transmit Delay is 1 sec, State DR, Priority 1
No backup designated router on this network
Multicast group memberships: <None>
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
No Hellos (Passive interface)
Neighbor Count is 0, Adjacent neighbor count is 0
ens192 is up
ifindex 2, MTU 1500 bytes, BW 10000 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
Internet Address 138.80.232.139/26, Broadcast 138.80.232.191, Area 0.0.0.0
MTU mismatch detection: enabled
Router ID 138.80.232.139, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DROther, Priority 0
No backup designated router on this network
Multicast group memberships: OSPFAllRouters
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 0.815s
Neighbor Count is 8, Adjacent neighbor count is 1
See also the show ip ospf route
command (trimmed to the relevant section):
dhcptst1.cdu.edu.au# show ip ospf route
============ OSPF network routing table ============
...
N 138.80.255.102/32 [10000] area: 0.0.0.0
directly attached to dhcp
N 138.80.255.202/32 [10010] area: 0.0.0.0
directly attached to dhcp
...
You can see here that the two anycast IP addresses being advertised are 138.80.255.102
and 138.80.255.202
, with a cost of 10000 and 10010 respectively.
Ok, so how can we check the costing on our Cisco router?
Checking OSPF costs on cisco side
The command to use on the cisco device is show ip ospf rib
x1c1coresw1>show ip ospf rib
OSPF Router with ID (138.80.232.33) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
...
*> 138.80.255.102/32, Intra, cost 10001, area 0.0.0.0
via 138.80.232.139, Vlan128
...
*> 138.80.255.202/32, Intra, cost 10011, area 0.0.0.0
via 138.80.232.139, Vlan128
You can see here that my server on 138.80.232.139
is showing up as the router for the two anycast addresses, with a cost of 10001 and 10011 – the costs I am sending above but with 1 added on for the link cost.
Therefore everything is working nicely.