User Tools

Site Tools


documentation:examples:simple_bgp-rip-ospf_lab

BGP/OSPF/RIP lab with FRRouting

This Labs is done with BSDRP under qemu and it explains how to use BSDRP using FRRouting (Quagga fork).

Presentation

Network diagram

Here is the logical and physical view:

Setting-up the lab

Downloading BSD Router Project images

Download BSDRP serial image (prevent to have to use an X display) on Sourceforge.

Download Lab scripts

More information on these BSDRP lab scripts available on How to build a BSDRP router lab.

Start the lab with 4 routers, here is an example with VirtualBox:

./BSDRP-lab-vbox.sh -i BSDRP_0.32_full_amd64_serial.img -n 4

Routers configuration

Router 1

Configure interface IP address (dual em/vtnet setup) and routing protocols from Quagga vtysh:

sysrc hostname=router1
hostname router1
sysrc ipsec_enable=YES
sysrc ipsec_file="/etc/ipsec.conf"
cat <<EOF > /etc/ipsec.conf
flush ;
add 192.168.13.1 192.168.13.3 tcp 0x1000 -A tcp-md5 "abigpassword" ;
add 192.168.13.3 192.168.13.1 tcp 0x1001 -A tcp-md5 "abigpassword" ;
add -6 2001:db8:13::1 2001:db8:13::3 tcp 0x1002 -A tcp-md5 "abigpassword" ;
add -6 2001:db8:13::3 2001:db8:13::1 tcp 0x1003 -A tcp-md5 "abigpassword" ;
EOF

service ipsec start
sysrc frr_enable=yes
service frr start
cli
conf t
interface em0
 ip address 192.168.12.1/24
 ipv6 address 2001:db8:12::1/64
interface em1
 ip address 192.168.13.1/24
 ipv6 address 2001:db8:13::1/64
interface vtnet0
 ip address 192.168.12.1/24
 ipv6 address 2001:db8:12::1/64
interface vtnet1
 ip address 192.168.13.1/24
 ipv6 address 2001:db8:13::1/64
router bgp 12
 bgp router-id 1.1.1.1
 neighbor 192.168.12.2 remote-as 12
 neighbor 192.168.13.3 remote-as 34
 neighbor 192.168.13.3 password abigpassword
 neighbor 2001:db8:12::2 remote-as 12
 neighbor 2001:db8:13::3 remote-as 34
 neighbor 2001:db8:13::3 password abigpassword
 address-family ipv4 unicast
  neighbor 192.168.12.2 next-hop-self
  exit-address-family
 address-family ipv6 unicast
  neighbor 2001:db8:12::2 activate
  neighbor 2001:db8:12::2 next-hop-self
  neighbor 2001:db8:13::3 activate
  exit-address-family
router ospf
 ospf router-id 1.1.1.1
 network 192.168.12.0/24 area 0.0.0.0
router ospf6
 router-id 1.1.1.1
 interface em0 area 0.0.0.0
 interface vtnet0 area 0.0.0.0
 exit
exit
wr
exit
config save

Router 2

Interfaces

Create a second loopback interface

sysrc hostname=router2
hostname router2
sysrc cloned_interfaces=lo1
service netif restart
sysrc frr_enable=yes
service frr start
cli
conf t
interface em0
 ip address 192.168.12.2/24
 ipv6 address 2001:db8:12::2/64
interface lo1
 ip address 192.168.20.2/24
 ipv6 address 2001:db8:20::2/64
interface vtnet0
 ip address 192.168.12.2/24
 ipv6 address 2001:db8:12::2/64
router bgp 12
 bgp router-id 192.168.20.2
 neighbor 192.168.12.1 remote-as 12
 neighbor 2001:db8:12::1 remote-as 12
 address-family ipv4 unicast
  network 192.168.20.0/24
  exit-address-family
 address-family ipv6 unicast
  network 2001:db8:20::/64
  neighbor 2001:db8:12::1 activate
 exit-address-family
router ospf
 ospf router-id 2.2.2.2
 network 192.168.12.0/24 area 0.0.0.0
 network 192.168.20.0/24 area 0.0.0.0
router ospf6
 router-id 2.2.2.2
 interface em0 area 0.0.0.0
 interface vtnet0 area 0.0.0.0
 interface lo1 area 0.0.0.0
 exit
exit
wr
exit
config save

Now check OSPF neighbor between router1 and router2:

# cli

Hello, this is FRRouting (version 2.0).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

router2# sh ip ospf neighbor

Neighbor ID     Pri State           Dead Time Address         Interface            RXmtL RqstL DBsmL
1.1.1.1           1 Full/Backup       37.275s 192.168.12.1    vtnet0:192.168.12.2      0     0     0

router2# sh ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime  State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:39   Full/BDR             00:00:41 vtnet0[DR]

And check BGP between router1 and router2:

router2# sh ip bgp summary
BGP router identifier 192.168.20.2, local AS number 12 vrf-id 0
BGP table version 1
RIB entries 1, using 120 bytes of memory
Peers 2, using 27 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
192.168.12.1    4         12       3       5        0    0    0 00:01:45            0
2001:db8:12::1  4         12       7      11        0    0    0 00:01:28            0

Total number of neighbors 2

Router 3

sysrc hostname=router3
hostname router3
sysrc frr_enable=YES
sysrc ipsec_enable=YES
sysrc ipsec_file="/etc/ipsec.conf"
cat <<EOF > /etc/ipsec.conf
flush ;
add 192.168.13.1 192.168.13.3 tcp 0x1000 -A tcp-md5 "abigpassword" ;
add 192.168.13.3 192.168.13.1 tcp 0x1001 -A tcp-md5 "abigpassword" ;
add -6 2001:db8:13::1 2001:db8:13::3 tcp 0x1002 -A tcp-md5 "abigpassword" ;
add -6 2001:db8:13::3 2001:db8:13::1 tcp 0x1003 -A tcp-md5 "abigpassword" ;

EOF

service ipsec start
service frr start
cli
conf t
   interface em2
     ip address 192.168.34.3/24
     ipv6 address 2001:db8:34::3/64
   interface vtnet2
     ip address 192.168.34.3/24
     ipv6 address 2001:db8:34::3/64
   interface em0
     ip address 192.168.13.3/24
     ipv6 address 2001:db8:13::3/64
   interface vtnet0
     ip address 192.168.13.3/24
     ipv6 address 2001:db8:13::3/64
  router rip
    network 192.168.34.0/24
  router ripng
    network em2
    network vtnet2
  router bgp 34
    bgp router-id 3.3.3.3
    neighbor 192.168.13.1 remote-as 12
    neighbor 192.168.13.1 password abigpassword
    neighbor 192.168.34.4 remote-as 34
    neighbor 192.168.34.4 next-hop-self
    neighbor 2001:db8:13::1 remote-as 12
    neighbor 2001:db8:13::1 password abigpassword
    neighbor 2001:db8:34::4 remote-as 34
    neighbor 2001:db8:34::4 next-hop-self
    address-family ipv6
      neighbor 2001:db8:34::4 next-hop-self
      neighbor 2001:db8:34::4 activate
      neighbor 2001:db8:13::1 activate
      exit
    exit
  exit
wr
exit
config save

Checking BGP peer with router 1

Now check BGP peer with router 1:

[root@router3]~# cli

Hello, this is FRRouting (version 2.0).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

router3# sh ip bgp summary
BGP router identifier 3.3.3.3, local AS number 34 vrf-id 0
BGP table version 5
RIB entries 1, using 120 bytes of memory
Peers 4, using 53 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
192.168.13.1    4         12      10      11        0    0    0 00:07:13            1
192.168.34.4    4         34       0       0        0    0    0    never       Active
2001:db8:13::1  4         12      21      26        0    0    0 00:07:06            1
2001:db8:34::4  4         34       0       0        0    0    0    never       Active

Total number of neighbors 4

router3# sh ip route bgp
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, T - Table, v - VNC,
       V - VNC-Direct,
       > - selected route, * - FIB route

B>* 192.168.20.0/24 [20/0] via 192.168.13.1, vtnet0, 00:07:56

Router 4

sysrc hostname=router4
hostname router4
sysrc frr_enable=YES
sysrc cloned_interfaces=lo1
service netif restart
service frr start
cli
conf t
interface em2
 ip address 192.168.34.4/24
 ipv6 address 2001:db8:34::4/64
interface lo1
 ip address 192.168.40.4/24
 ipv6 address 2001:db8:40::4/64
interface vtnet2
 ip address 192.168.34.4/24
 ipv6 address 2001:db8:34::4/64
router rip
 network 192.168.34.0/24
 network 192.168.40.0/24
router ripng
 network 2001:db8:34::/64
 network 2001:db8:40::/64
router bgp 34
 bgp router-id 4.4.4.4
 neighbor 192.168.34.3 remote-as 34
 neighbor 2001:db8:34::3 remote-as 34
 address-family ipv4 unicast
  network 192.168.40.0/24
  exit-address-family
 address-family ipv6 unicast
  network 2001:db8:40::/64
  neighbor 2001:db8:34::3 activate
  exit-address-family
 exit
exit
wr
exit
config save

Checking RIP neighbor with router 3

Now check RIP update from router 3:

router4# sh ip rip status
Routing Protocol is "rip"
  Sending updates every 30 seconds with +/-50%, next due in 25 seconds
  Timeout after 180 seconds, garbage collect after 120 seconds
  Outgoing update filter list for all interface is not set
  Incoming update filter list for all interface is not set
  Default redistribution metric is 1
  Redistributing:
  Default version control: send version 2, receive any version
    Interface        Send  Recv   Key-chain
    lo1              2     1 2
    vtnet2           2     1 2
  Routing for Networks:
    192.168.34.0/24
    192.168.40.0/24
  Routing Information Sources:
    Gateway          BadPackets BadRoutes  Distance Last Update
  Distance: (default is 120)
router4# sh ipv6 ripng status
Routing Protocol is "RIPng"
  Sending updates every 30 seconds with +/-50%, next due in 9 seconds
  Timeout after 180 seconds, garbage collect after 120 seconds
  Outgoing update filter list for all interface is not set
  Incoming update filter list for all interface is not set
  Default redistribution metric is 1
  Redistributing:
  Default version control: send version 1, receive version 1
    Interface        Send  Recv
    vtnet2           1     1
  Routing for Networks:
    2001:db8:34::/64
    2001:db8:40::/64
  Routing Information Sources:
    Gateway          BadPackets BadRoutes  Distance Last Update
    fe80::5a9c:fcff:fe03:403
                        0          0        120      00:00:06

Checking BGP peer with router 3

Now check BGP peer with router 3:

router4# sh ip bgp summary
BGP router identifier 4.4.4.4, local AS number 34 vrf-id 0
BGP table version 2
RIB entries 3, using 360 bytes of memory
Peers 2, using 27 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
192.168.34.3    4         34       4       5        0    0    0 00:01:33            1
2001:db8:34::3  4         34       6       7        0    0    0 00:01:33            1

Total number of neighbors 2

Final testing

Ping router4 loopback from router2 loopback:

[root@router2]~# ping -c 4 -S 192.168.20.2 192.168.40.4
PING 192.168.40.4 (192.168.40.4) from 192.168.20.2: 56 data bytes
64 bytes from 192.168.40.4: icmp_seq=0 ttl=62 time=0.281 ms
64 bytes from 192.168.40.4: icmp_seq=1 ttl=62 time=0.229 ms
64 bytes from 192.168.40.4: icmp_seq=2 ttl=62 time=0.213 ms
64 bytes from 192.168.40.4: icmp_seq=3 ttl=62 time=0.258 ms

--- 192.168.40.4 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.213/0.245/0.281/0.026 ms

[root@router2]~# ping6 -c 4 -S 2001:db8:20::2 2001:db8:40::4
PING6(56=40+8+8 bytes) 2001:db8:20::2 --> 2001:db8:40::4
16 bytes from 2001:db8:40::4, icmp_seq=0 hlim=62 time=0.382 ms
16 bytes from 2001:db8:40::4, icmp_seq=1 hlim=62 time=0.237 ms
16 bytes from 2001:db8:40::4, icmp_seq=2 hlim=62 time=0.278 ms
16 bytes from 2001:db8:40::4, icmp_seq=3 hlim=62 time=0.237 ms

--- 2001:db8:40::4 ping6 statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.237/0.283/0.382/0.059 ms

You need to “force” the source IP addresse to use the loopback (192.168.20.2), otherwise router2 will use the output NIC IP addresse as source (which is 192.168.12.2). But router 4 don't know the network 192.168.12.0/24, then it can't answer to router2 ping.

documentation/examples/simple_bgp-rip-ospf_lab.txt · Last modified: 2017/07/01 23:05 by olivier