Ryu BGP speaker

Since this is a pretty involved process, I would recommend opening four different SSH sessions to the OpenFlow virtual machine: one for Ryu speaker, one for Mininet, one for the router application, and one for executing the ovs-vsctl commands. to ssh to should NOT be the VMnet2 IP in the 172.16.1.0/24 range, because we are using that as the data path between spine-1 and our router, and we will add that interface to s1 OVS bridge later on.
In order to communicate with the flat1 VMnet3 network, we need to add the virtual Ethernet interface on the virtual machine as well. For me, this is Ethernet3, and I added the IP of 172.16.2.52 for the interface:

ubuntu@sdnhubvm:~/ryu_latest[02:44] (master)$ ifconfig eth3
eth3 Link encap:Ethernet HWaddr 00:0c:29:87:67:c9
inet addr:172.16.2.52 Bcast:172.16.2.255 Mask:255.255.255.0

We will use the BGP configuration, chapter13_bgp_1.py, as illustrated next, where we have defined the BGP neighbor first:

BGP = {
'local_as': 1,
'router_id': '172.16.2.52',
'neighbors': [
{
'address': '172.16.2.51',
'remote_as': 1,
'enable_ipv4': True,
'enable_ipv6': True,
'enable_vpnv4': True,
'enable_vpnv6': True
},
],

 

    'routes': [
# Example of IPv4 prefix
{
'prefix': '10.20.1.0/24',
'next_hop': '172.16.1.174'
},
{
'prefix': '172.16.1.0/24'
},
{
'prefix': '172.16.2.0/24'
}
]
}

; therefore, the next hop is the IP of the Mininet OVS segment IP. We are using iBGP peer to allow us the flexibility to specify non-local next hop without the Cisco device rejecting it. Also, note that because we are using multiple applications on the same host, listening on all ports will be very confusing. Therefore, we have the application interface via the ofp-listen-host option in Ryu-manager.
We will start the Ryu BGP speaker using the BGP application that we saw in Chapter 11, OpenFlow Advance Topics:

$ sudo ryu-manager --verbose --ofp-listen-host 172.16.1.52 --bgp-app-config-file mastering_python_networking/Chapter13/chapter13_bgp_1.py ryu/services/protocols/bgp/application.py

Following are some useful outputs from Ryu, spine-1, and leaf-1 for BGP neighbor relationship establishment that you can look for in your lab:

# Ryu
Loading config file mastering_python_networking/Chapter13/chapter13_bgp_1.py...
Loading BGP settings...
Starting BGPSpeaker...
...
Adding route settings: {'prefix': '10.20.1.0/24', 'next_hop': '172.16.1.174'}
...
Peer 172.16.2.51 BGP FSM went from Idle to Connect
Peer 172.16.2.51 BGP FSM went from Connect to OpenSent
Connection to peer: 172.16.2.51 established

# spine-1
*<date> 22:56:39.322: %BGP-5-ADJCHANGE: neighbor 172.16.2.52 Up
spine-1#sh ip route 10.20.1.0
Routing entry for 10.20.1.0/24
Known via "bgp 1", distance 200, metric 0, type internal
Last update from 172.16.1.174 00:05:16 ago
Routing Descriptor Blocks:
* 172.16.1.174, from 172.16.2.52, 00:05:16 ago
Route metric is 0, traffic share count is 1
AS Hops 0
MPLS label: none

# leaf-1
leaf-1#sh ip route 10.20.1.0
Routing entry for 10.20.1.0/24
Known via "bgp 2", distance 20, metric 0
Tag 1, type external
Last update from 10.0.128.1 00:08:27 ago
Routing Descriptor Blocks:
* 10.0.128.1, from 10.0.128.1, 00:08:27 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 1
MPLS label: none
leaf-1#

We can see that the BGP routes are being advertised correctly across the network. Let's build the Mininet network.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.216.175