Custom Search

Tuesday, July 15, 2014

OpenStack neutron introduction to network connectivity of OpenvSwitch bridges/switches br-ex and br-int and network namespaces router and dhcp

1)
If you run the command "#ifconfig -a" on host, you should see the interfaces "br-ex" and "br-int".
#ifconfig -a

1a)
http://openstack.redhat.com/images/c/cc/Neutron_architecture.png  <=== Imp
http://docs.openstack.org/trunk/install-guide/install/apt/content/neutron-network-node.html
http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=FAQ;hb=HEAD

Here the bridges "br-ex" and "br-int" are created using following OpenVswitch commands
# ovs-vsctl add-br br-int
# ovs-vsctl add-br br-ex


1b)
Add a Port/Interface to "br-ex" interface
# ovs-vsctl add-port br-ex

* Important: Here the "EXTERNAL_INTERFACE" is defined in the "router-namespace". Run the command "#sudo ip netns exec route-namespace ip link show" to see this interface.

1c)
List the Ports/interfaces defined in the OpenVswitch bridge/switch "br-ex".
#sudo ovs-vsctl list-ports br-ex
OR
#sudo ovs-vsctl list-ifaces br-ex

2)
Run the command "#ip netns" on host to see the "router" and "dhcp" namespaces.
Example:
#ip netns list
qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589
qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838

OR

* Another way to find all namespaces
#ls -la /var/run/netns/

2a)
Get help for namespace (#ip netns) command
#ip netns help
Usage: ip netns list
       ip netns add NAME
       ip netns delete NAME
       ip netns identify PID
       ip netns pids NAME
       ip netns exec NAME cmd ...
       ip netns monitor

2b)
Get PID of a namespace
#sudo ip netns pids

Examples:
#sudo ip netns pids qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838
10990


#sudo ip netns pids qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589
26731


2c)
Get name of the namespace from PID
#sudo ip netns identify

Examples:
#sudo ip netns identify 10990
qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838

#sudo ip netns identify 26731
qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589

2d)
Find the process which create namespace, using PID
#ps -aux | grep

Examples:
#ps -aux | grep 10990
root     10990  0.0  0.6  85428 24632 ?        S    13:58   0:00 /usr/bin/python /usr/local/bin/neutron-ns-metadata-proxy --pid_file=/opt/stack/data/neutron/external/pids/e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838.pid --metadata_proxy_socket=/opt/stack/data/neutron/metadata_proxy --router_id=e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 --state_path=/opt/stack/data/neutron --metadata_port=9697 --debug --verbose

#ps -aux | grep 26731
nobody   26731  0.0  0.0  28204  1004 ?        S    15:18   0:00 dnsmasq --no-hosts --no-resolv --strict-order --bind-interfaces --interface=tap99bf0e0c-70 --except-interface=lo --pid-file=/opt/stack/data/neutron/dhcp/5fb186d7-1836-4505-b8c5-ce8219d51589/pid --dhcp-hostsfile=/opt/stack/data/neutron/dhcp/5fb186d7-1836-4505-b8c5-ce8219d51589/host --addn-hosts=/opt/stack/data/neutron/dhcp/5fb186d7-1836-4505-b8c5-ce8219d51589/addn_hosts --dhcp-optsfile=/opt/stack/data/neutron/dhcp/5fb186d7-1836-4505-b8c5-ce8219d51589/opts --leasefile-ro --dhcp-range=set:tag0,10.0.0.0,static,86400s --dhcp-lease-max=256 --conf-file= --domain=openstacklocal

3)
You can find that the interface defined in the "router-namespace" is added in the OpenVSwitch bridge/switch "br-ex" as port/iface.
Please use following command to confirm this.

3a)
Find ports/interfaces added in the OpenVswitch bridge/switch "br-ex"
#sudo ovs-vsctl list-ports br-ex
qg-b9fd2b47-d6

OR

#sudo ovs-vsctl list-ifaces br-ex
qg-b9fd2b47-d6

3b)
List all namespaces
#ip netns list
qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589
qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838

3c)
List interfaces defined in the router namespace
#sudo ip netns exec qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

13: qr-217ed2de-b2: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether fa:16:3e:25:26:d1 brd ff:ff:ff:ff:ff:ff

14: qg-b9fd2b47-d6: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether fa:16:3e:3d:44:e1 brd ff:ff:ff:ff:ff:ff

3d)
* You can see that the interface "qg-b9fd2b47-d6" defined in the router namespace "qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838" got added in the OpenVswitch bridge/switch "br-ex".

* The OpenVSwitch bridge/switch "br-ex" and the interface "qg-b9fd2b47-d6" in the router namespace "qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838" should be in the same network.
From follwoing example you can find that both are in "172.24.4.x" network.Both of then should be in same network.
Example:
#ifconfig
br-ex
inet addr:172.24.4.1

#sudo ip netns exec qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 ifconfig
qg-b9fd2b47-d6

inet addr:172.24.4.2

3e)
IP of "br-ex" OpenVswitch bridge/switch

#ifconfig br-ex
br-ex     Link encap:Ethernet  HWaddr 6a:14:24:c0:d8:42 
          inet addr:172.24.4.1  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:906 (906.0 B)  TX bytes:270 (270.0 B)
3d)
IP of "qg-b9fd2b47-d6" interface in the router namespace "qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838"

#sudo ip netns exec qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 ifconfig -a qg-b9fd2b47-d6
qg-b9fd2b47-d6 Link encap:Ethernet  HWaddr fa:16:3e:3d:44:e1 
          inet addr:172.24.4.2  Bcast:172.24.4.255  Mask:255.255.255.0
          inet6 addr: fe80::f816:3eff:fe3d:44e1/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:906 (906.0 B)

4)
Now, We can check "br-int" OpenVswitch bridge/switch.

4a)
List all ports/ifaces in the "br-int" OpenVswitch bridge/switch.

#sudo ovs-vsctl list-ports br-int

qr-217ed2de-b2
tap99bf0e0c-70


OR

#sudo ovs-vsctl list-ifaces br-int
qr-217ed2de-b2
tap99bf0e0c-70

* You can see that "br-int" OpenVswitch bridge/switch has 2 ports/ifaces "qr-217ed2de-b2" and "tap99bf0e0c-70" are added to it.
* Here the port/iface "qr-217ed2de-b2" actually defined in the router namespace "qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838".
* Here the port/iface "tap99bf0e0c-70" actually defined in the dhcp namespace "qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589".
* Please check the picture http://openstack.redhat.com/images/c/cc/Neutron_architecture.png

4b)
List the interface defined in the router namespace "qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838".
#sudo ip netns exec qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
13: qr-217ed2de-b2: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether fa:16:3e:25:26:d1 brd ff:ff:ff:ff:ff:ff
14: qg-b9fd2b47-d6: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether fa:16:3e:3d:44:e1 brd ff:ff:ff:ff:ff:ff

* Find the IP of "qg-b9fd2b47-d6" interface is
#sudo ip netns exec qrouter-e7ddc5e5-1f2c-46e7-92b0-85a0e6d4e838 ifconfig -a
qr-217ed2de-b2

inet addr:10.0.0.1

4c)
List the interface defined in the router namespace "qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589".
#sudo ip netns exec qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589 ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
15: tap99bf0e0c-70: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether fa:16:3e:f2:fb:92 brd ff:ff:ff:ff:ff:ff

* Find the IP of "tap99bf0e0c-70" interface is
#sudo ip netns exec qdhcp-5fb186d7-1836-4505-b8c5-ce8219d51589 ifconfig -a
tap99bf0e0c-70

inet addr:10.0.0.2

4d)
Note, "br-int" OpenVswitch bridge/switch doesn't have any IP.
#ifconfig br-int
br-int    Link encap:Ethernet  HWaddr 72:46:e8:0d:00:45 
          inet6 addr: fe80::b079:35ff:febd:d62f/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1812 (1.8 KB)  TX bytes:648 (648.0 B)

5)
what is br-int

http://docs.openstack.org/grizzly/openstack-network/admin/content/under_the_hood_openvswitch.html







2 comments:

  1. namespace
    ---------
    http://www.opencloudblog.com/?p=66
    http://www.opencloudblog.com/?p=116

    ReplyDelete
  2. http://techbackground.blogspot.in/2013/06/metadata-via-quantum-router.html

    ReplyDelete