OpenStack Networking Cookbook
上QQ阅读APP看书,第一时间看更新

Viewing the virtual interface information on the Network node

The previous recipe showed you how to identify the VIF information on the compute node. Now let's turn our attention to the Network node.

While a virtual machine is instantiated on a compute node, the DHCP server for the entire tenant Network is started on the Network node. As multiple tenant networks can have overlapping IP addresses, the Network node uses the concept of namespaces to isolate one Network from the other.

Getting ready

As this recipe is described from the point of view of an administrator troubleshooting a tenant problem, the following information is required:

  • The tenant Network name
  • The virtual machine instance whose VIF information is to be identified

How to do it…

The previous recipe showed you how to view the ports associated with a Network on the Network Detail screen. This recipe shows you how to look for the DHCP-related information on the Network node:

  1. In the left navigation menu, click on Admin | System | Networks. Click on the name of the Network to view the details of the network to which the virtual machine instance belongs.
  2. In the details of the Network, we can see the Ports associated with this Network. The DHCP Port for the selected network is highlighted as follows:
    How to do it…
  3. Click on the Port name to view the DHCP Port Detail. Note that the DHCP IP address is 70.70.70.3 and the Port ID starts with 18cc6f06-2b as highlighted here:
    How to do it…
  4. Now log in to the network node of your setup (the Controller and Network node of our setup for this chapter) with the appropriate credentials and execute the following command:
    openstack@controller:~$ ip netns
    qdhcp-bd09066a-eafe-4241-a7b4-bc9d8056d82b
    
  5. The output of the ip netns command lists all the Linux namespaces created on the node. In our setup, we can see a namespace called qdhcp-bd09066a-eafe-4241-a7b4-bc9d8056d82b. This name is generated by Neutron by adding qdhcp and the unique ID for the Network.
  6. To view the networking information and applications running in a namespace, we will need to start a command shell in the namespace. You can do this using the following command:
    openstack@controller:~$ sudo ip netns exec qdhcp-bd09066a-eafe-4241-a7b4-bc9d8056d82b /bin/bash
    
  7. Once this command is successful, you will get a new shell prompt. All the commands executed at this shell prompt are restricted to that namespace. Let's type the following ifconfig command at the prompt:
    How to do it…
  8. In the output of the ifconfig command, we can see an interface called tap18cc6f06-2b. You will notice that 18cc6f06-2b matches the first few characters of the DHCP port ID that we noted in step 3.
  9. Neutron uses dnsmasq to provide DHCP services. We can confirm that the dnsmasq process is using the tap18cc6f06-2b interface with the ps command as shown here:
    How to do it…
  10. Next, we will check how the tap18cc6f06-2b interface is connected to the external physical network. For this, we will exit the namespace shell prompt and execute the following ovs-vsctl show command on the controller shell:
    How to do it…
  11. As seen in the preceding output, the tap18cc6f06-2b interface is bound to the OVS bridge, br-eth1. This in turn uses the eth1 physical interface of the network node.
  12. As seen in the previous recipe, we can execute the ovs-ofctl dump-flows br-int command to confirm that the DHCP port is also using VLAN 1002 that was assigned to the tenant network.

How it works…

Namespaces are constructs in Linux that allows the users to create a copy of a full TCP/IP network stack including interfaces and routing tables. In the OpenStack networking, one DHCP server is started for each Network and an IP address from the corresponding subnet is assigned to the DHCP server. As the tenant networks can have similar or overlapping IP addresses, Neutron uses namespaces to isolate each DHCP server.

As we saw in the previous recipe, Neutron uses unique IDs to identify the physical and virtual network information. The namespace name contained the unique ID of the tenant network. Moreover, the interface used by the DHCP server contained the unique ID of the Network port.