User Tools

Site Tools


documentation:examples:simple_bgp-rip-ospf_lab

BGP/OSPF/RIP lab with Quagga

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

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

Interfaces

Enter in Quagga configuration (vtysh):

cli

And configure IP addresse on public interfaces:

router1.bsdrp.net# conf t
router1.bsdrp.net(config)# interface em0
router1.bsdrp.net(config-if)# ip address 192.168.12.1/24
router1.bsdrp.net(config-if)# ipv6 address 2001:db8:12::1/64
router1.bsdrp.net(config-if)# interface em1
router1.bsdrp.net(config-if)# ip address 192.168.13.1/24
router1.bsdrp.net(config-if)# ipv6 address 2001:db8:13::1/64
router1.bsdrp.net(config-if)# exit

OSPF

Then configure OSPF:

router1.bsdrp.net(config)# router ospf
router1.bsdrp.net(config-router)# router-id 1.1.1.1
router1.bsdrp.net(config-router)# network 192.168.12.0/24 area 0
router1.bsdrp.net(config-router)# exit
router1.bsdrp.net(config)# router ospf6
router1.bsdrp.net(config-ospf6)# router-id 1.1.1.1
router1.bsdrp.net(config-ospf6)# interface em0 area 0.0.0.0

BGP

Then configure BGP:

router1.bsdrp.net(config)# router bgp 12
router1.bsdrp.net(config-router)# bgp router-id 1.1.1.1
router1.bsdrp.net(config-router)# neighbor 192.168.12.2 remote-as 12
router1.bsdrp.net(config-router)# neighbor 192.168.12.2 next-hop-self
router1.bsdrp.net(config-router)# neighbor 192.168.13.3 remote-as 34
router1.bsdrp.net(config-router)# neighbor 2001:db8:12::2 remote-as 12
router1.bsdrp.net(config-router)# neighbor 2001:db8:12::2 next-hop-self
router1.bsdrp.net(config-router)# neighbor 2001:db8:13::3 remote-as 34
router1.bsdrp.net(config-router)# address-family ipv6
router1.bsdrp.net(config-router-af)# neighbor 2001:db8:12::2 activate
router1.bsdrp.net(config-router-af)# neighbor 2001:db8:13::3 activate
router1.bsdrp.net(config-router-af)# exit

Saving configuration

Then write quagga config file and exit the quagga cli:

router1.bsdrp.net(config)# exit
router1.bsdrp.net# wr
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]
router1.bsdrp.net# exit

Save configuration:

config save

Router 2

Interfaces

Create a second loopback interface

ifconfig lo1 create
echo 'cloned_interfaces="lo1"' >>  /etc/rc.conf

Enter in Quagga configuration mode (vtysh):

cli

Configure the IP addresses on public interfaces:

router2.bsdrp.net# conf t
router2.bsdrp.net(config)# interface em0
router2.bsdrp.net(config-if)# ip address 192.168.12.2/24
router2.bsdrp.net(config-if)# ipv6 address 2001:db8:12::2/64
router2.bsdrp.net(config)# interface lo1
router2.bsdrp.net(config-if)# ip address 192.168.20.2/24
router2.bsdrp.net(config-if)# ipv6 address 2001:db8:20::2/64
router2.bsdrp.net(config-if)# exit

OSPF

Then configure OSPF:

router2.bsdrp.net(config)# router ospf
router2.bsdrp.net(config-router)# router-id 2.2.2.2
router2.bsdrp.net(config-router)# network 192.168.12.0/24 area 0
router2.bsdrp.net(config-router)# network 192.168.20.0/24 area 0
router2.bsdrp.net(config-router)# exit
router2.bsdrp.net(config)# router ospf6 
router2.bsdrp.net(config-ospf6)# router-id 2.2.2.2
router2.bsdrp.net(config-ospf6)# interface em0 area 0.0.0.0
router2.bsdrp.net(config-ospf6)# interface lo1 area 0.0.0.0

BGP

Then configure BGP:

router2.bsdrp.net(config)# router bgp 12
router2.bsdrp.net(config-router)# bgp router-id 192.168.20.2
router2.bsdrp.net(config-router)# network 192.168.20.0/24
router2.bsdrp.net(config-router)# neighbor 192.168.12.1 remote-as 12
router2.bsdrp.net(config-router)# neighbor 2001:db8:12::1 remote-as 12
router2.bsdrp.net(config-router)# address-family ipv6
router2.bsdrp.net(config-router-af)# network 2001:db8:20::/64
router2.bsdrp.net(config-router-af)# neighbor 2001:db8:12::1 activate 
router2.bsdrp.net(config-router-af)# exit
router2.bsdrp.net(config-router)# exit

Saving configuration

Then write quagga config file and exit the quagga cli:

router2.bsdrp.net(config)# exit
router2.bsdrp.net# wr mem
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]

Now check OSPF neighbor between router1 and router2:

router2.bsdrp.net# sh ip ospf neighbor

    Neighbor ID Pri State           Dead Time Address         Interface            RXmtL RqstL DBsmL
1.1.1.1           1 Full/DR           31.872s 192.168.12.1    em0:192.168.12.2         0     0     0

router2.bsdrp.net# sh ipv6 ospf6 neighbor 
Neighbor ID     Pri    DeadTime  State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:38   Full/BDR             09:20:43 em0[DR]

And check BGP between router1 and router2:

router2.bsdrp.net# sh ip bgp summary 
BGP router identifier 2.2.2.2, local AS number 12
RIB entries 3, using 192 bytes of memory
Peers 2, using 5040 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.12.1    4    12     570     571        0    0    0 09:27:35        1
2001:db8:12::1  4    12     571     572        0    0    0 09:27:35        0

Total number of neighbors 2

Exit vtsh:

router1.bsdrp.net# exit

Save configuration:

config save

Router 3

Interfaces

Enter in Quagga configuration mode (vtysh):

cli

Configure the IP addresses on public interfaces:

router3.bsdrp.net# conf t
router3.bsdrp.net(config)# interface em2
router3.bsdrp.net(config-if)# ip address 192.168.34.3/24
router3.bsdrp.net(config-if)# ipv6 address 2001:db8:34::3/64
router3.bsdrp.net(config)# interface em0
router3.bsdrp.net(config-if)# ip address 192.168.13.3/24
router3.bsdrp.net(config-if)# ipv6 address 2001:db8:13::3/64
router3.bsdrp.net(config-if)# exit

RIP

Then configure RIP:

router3.bsdrp.net(config)# router rip
router3.bsdrp.net(config-router)# network 192.168.34.0/24
router3.bsdrp.net(config-router)# exit
router3.bsdrp.net(config)# router ripng
router3.bsdrp.net(config-router)# network em2
router3.bsdrp.net(config-router)# exit

BGP

Then configure BGP:

router3.bsdrp.net(config)# router bgp 34
router3.bsdrp.net(config-router)# bgp router-id 3.3.3.3
router3.bsdrp.net(config-router)# neighbor 192.168.13.1 remote-as 12
router3.bsdrp.net(config-router)# neighbor 192.168.34.4 remote-as 34
router3.bsdrp.net(config-router)# neighbor 192.168.34.4 next-hop-self
router3.bsdrp.net(config-router)# neighbor 2001:db8:13::1 remote-as 12
router3.bsdrp.net(config-router)# neighbor 2001:db8:34::4 remote-as 34
router3.bsdrp.net(config-router)# neighbor 2001:db8:34::4 next-hop-self
router3.bsdrp.net(config-router)# address-family ipv6
router3.bsdrp.net(config-router-af)# neighbor 2001:db8:34::4 activate
router3.bsdrp.net(config-router-af)# neighbor 2001:db8:13::1 activate
router3.bsdrp.net(config-router)# exit

Checking BGP peer with router 1

Now check BGP peer with router 1:

router3.bsdrp.net# sh ip bgp summary  
BGP router identifier 3.3.3.3, local AS number 34
RIB entries 3, using 192 bytes of memory
Peers 2, using 5040 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.13.1    4    12    2274    2279        0    0    0 1d13h39m        1
2001:db8:13::1  4    12    2290    2293        0    0    0 1d12h04m        0

Total number of neighbors 2

router3.bsdrp.net# sh ip route bgp 
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

B>* 192.168.20.0/24 [20/0] via 192.168.13.1, em0, 09:30:17

Saving configuration

Then write quagga config file and exit the quagga cli:

router3.bsdrp.net(config)# exit
router3.bsdrp.net# wr mem
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]

Exit Quagga cli:

router3.bsdrp.net# exit

Save configuration:

config save

Router 4

Interfaces

Create a second loopback interface

ifconfig lo1 create
echo 'cloned_interfaces="lo1"' >>  /etc/rc.conf

Enter in Quagga configuration mode (vtysh):

cli

Configure the IP addresses on public interfaces:

router4.bsdrp.net# conf t
router4.bsdrp.net(config)# interface em2
router4.bsdrp.net(config-if)# ip address 192.168.34.4/24
router4.bsdrp.net(config-if)# ipv6 address 2001:db8:34::4/64
router4.bsdrp.net(config)# int lo1
router4.bsdrp.net(config-if)# ip address 192.168.40.4/24
router4.bsdrp.net(config-if)# ipv6 address 2001:db8:40::4/64
router4.bsdrp.net(config-if)# exit

RIP

Then configure RIP:

router4.bsdrp.net(config)# router rip
router4.bsdrp.net(config-router)# network 192.168.34.0/24
router4.bsdrp.net(config-router)# network 192.168.40.0/24
router4.bsdrp.net(config-router)# exit
router4.bsdrp.net(config)# router ripng
router4.bsdrp.net(config-router)# network 2001:db8:34::/64
router4.bsdrp.net(config-router)# network 2001:db8:40::/64
router4.bsdrp.net(config-router)# exit

BGP

Then configure BGP:

router4.bsdrp.net(config)# router bgp 34
router4.bsdrp.net(config-router)# bgp  router-id 4.4.4.4
router4.bsdrp.net(config-router)# network 192.168.40.0/24
router4.bsdrp.net(config-router)# ipv6 bgp network 2001:db8:40::/64
router4.bsdrp.net(config-router)# neighbor 192.168.34.3 remote-as 34
router4.bsdrp.net(config-router)# neighbor 2001:db8:34::3 remote-as 34
router4.bsdrp.net(config-router)# address-family ipv6
router4.bsdrp.net(config-router)# network 2001:db8:40::/64
router4.bsdrp.net(config-router-af)# neighbor 2001:db8:34::3 activate
router4.bsdrp.net(config-router)# exit

Checking RIP neighbor with router 3

Now check RIP update from router 3:

router4.bsdrp.net# sh ip rip status
Routing Protocol is "rip"
  Sending updates every 30 seconds with +/-50%, next due in 15 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
    em2              2     1 2
    lo1              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.bsdrp.net# sh ipv6 ripng status 
Routing Protocol is "RIPng"
  Sending updates every 30 seconds with +/-50%, next due in 8 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
    em2              1     1  
  Routing for Networks:
    2001:db8:34::/64
    2001:db8:40::/64
  Routing Information Sources:
    Gateway          BadPackets BadRoutes  Distance Last Update
    fe80::a8aa:ff:fe00:334 
                        0          0        120      00:00:00

Checking BGP peer with router 3

Now check BGP peer with router 3:

router4.bsdrp.net# sh ip bgp summary 
BGP router identifier 4.4.4.4, local AS number 34
RIB entries 1, using 64 bytes of memory
Peers 2, using 5040 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.34.3    4    34      18      23        0    0    0 00:09:40        0
2001:db8:34::3  4    34      19      35        0    0    0 00:00:52        0

Total number of neighbors 2

Saving configuration

Then write quagga config file and exit the quagga cli:

router2.bsdrp.net(config)# exit
router2.bsdrp.net# wr mem
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]

Exit Quagga cli:

router4.bsdrp.net# exit

Save configuration:

config save

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=3.095 ms
64 bytes from 192.168.40.4: icmp_seq=1 ttl=62 time=2.228 ms
64 bytes from 192.168.40.4: icmp_seq=2 ttl=62 time=2.245 ms
64 bytes from 192.168.40.4: icmp_seq=3 ttl=62 time=2.422 ms

--- 192.168.40.4 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.228/2.498/3.095/0.353 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=9.295 ms
16 bytes from 2001:db8:40::4, icmp_seq=1 hlim=62 time=4.975 ms
16 bytes from 2001:db8:40::4, icmp_seq=2 hlim=62 time=5.732 ms
16 bytes from 2001:db8:40::4, icmp_seq=3 hlim=62 time=5.409 ms

--- fc:40::4 ping6 statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 4.975/6.353/9.295/1.720 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: 2011/09/24 00:13 (external edit)