Deep understanding of the OpenStack Network Architecture (3)-----Routing

Source: Internet
Author: User

Original address: Https://blogs.oracle.com/ronen/entry/diving_into_openstack_network_architecture2

Translation from: http://blog.csdn.net/halcyonbaby/article/details/41604459

In the previous article, we learned about several basic network components used by the OpenStack network and explained how the network was communicated through some simple use cases. In this article, we will explore the settings of the network through a slightly more complex (and still fairly basic) use case (two inter-network routing). The routing uses the same components as the connected internal network, using namespace to create an isolated container that allows the network packets between the subnet to relay.
Remembering what we said in the first article, this is just an example of using the OvS plugin. OpenStack has a lot of plugins in different ways, and we're just talking about one of them.

Use case #4: Routing traffic between, isolated networks

In reality, we will create different networks for different purposes. We will also need to connect these networks together. Since two networks are in different IP segments, we need router to connect them together. To analyze this setup, we create another network (NET2) and configure a 20.20.20.0/24 subnet. After this network is created, we launch a virtual machine for Oracle Linux and connect to Net2. is the network topology diagram seen from the Openstackgui:



For further exploration, we will see another namespace on the OpenStack network node, the namespace used to service the newly created network. Now we have two namespace, one for each network.

[Plain]View Plaincopy
    1. # IP Netns List
    2. Qdhcp-63b7fcf2-e921-4011-8da9-5fc2444b42dd
    3. qdhcp-5f833617-6179-4797-b7c0-7d420d84040c

You can view the network ID information through the Nova Net-list, or use the UI to view Web information.

[Plain]View Plaincopy
    1. # Nova Net-list
    2. +--------------------------------------+-------+------+
    3. | ID | Label | CIDR |
    4. +--------------------------------------+-------+------+
    5. | 5f833617-6179-4797-b7c0-7d420d84040c | Net1 | None |
    6. | 63B7FCF2-E921-4011-8DA9-5FC2444B42DD | Net2 | None |
    7. +--------------------------------------+-------+------+

Our newly created Network,net2 has its own namespace, and this namespace is separate from the Net1. In namespace, we can see two network interfaces, one local and one for the DHCP service.

[Plain]View Plaincopy
  1. # IP netns exec qdhcp-63b7fcf2-e921-4011-8da9-5fc2444b42dd IP addr
  2. 1:LO:MTU 65536 qdisc noqueue State UNKNOWN
  3. Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00
  4. inet 127.0.0.1/8 Scope host Lo
  5. INET6:: 1/128 Scope Host
  6. Valid_lft Forever Preferred_lft Forever
  7. 19:TAP16630347-45:MTU Qdisc Noqueue State UNKNOWN
  8. Link/ether fa:16:3e:bd:94:42 BRD FF:FF:FF:FF:FF:FF
  9. inet 20.20.20.3/24 BRD 20.20.20.255 Scope Global tap16630347-45
  10. Inet6 FE80::F816:3EFF:FEBD:9442/64 Scope link
  11. Valid_lft Forever Preferred_lft Forever

Net1 and Net2 Two network is not connected, we need to create a router, through the router will be two network unicom. Openstack Neutron provides users with the ability to create router and connect two or more network connections. Router is actually just an extra namespace. Creating router using neutron can be done via GUI or command line:

[Plain]View Plaincopy
  1. # neutron Router-create My-router
  2. Created a new router:
  3. +-----------------------+--------------------------------------+
  4. | Field | Value |
  5. +-----------------------+--------------------------------------+
  6. | admin_state_up | True |
  7. |                                      External_gateway_info | |
  8. | ID | fce64ebe-47f0-4846-b3af-9cf764f1ff11 |
  9. | name | My-router |
  10. | Status | ACTIVE |
  11. | tenant_id | 9796e5145ee546508939cd49ad59d51f |
  12. +-----------------------+--------------------------------------+

Now we connect the two Netwrok via router:

To view the ID of the subnet:

[Plain]View Plaincopy
  1. # neutron Subnet-list
  2. +--------------------------------------+------+---------------+------------------------------------------------ +
  3. | ID | name | CIDR | Allocation_pools |
  4. +--------------------------------------+------+---------------+------------------------------------------------ +
  5. |      2D7A0A58-0674-439A-AD23-D6471AAAE9BC | | 10.10.10.0/24 | {"Start": "10.10.10.2", "End": "10.10.10.254"} |
  6. |      4a176b4e-a9b2-4bd8-a2e3-2dbe1aeaf890 | | 20.20.20.0/24 | {"Start": "20.20.20.2", "End": "20.20.20.254"} |
  7. +--------------------------------------+------+---------------+------------------------------------------------ +

Add subnet 10.10.10.0/24 to Router:

[Plain]View Plaincopy
    1. # neutron Router-interface-add fce64ebe-47f0-4846-b3af-9cf764f1ff11 SUBNET=2D7A0A58-0674-439A-AD23-D6471AAAE9BC
    2. Added interface 0b7b0b40-f952-41dd-ad74-2c15a063243a to Router fce64ebe-47f0-4846-b3af-9cf764f1ff11.

Add subnet 20.20.20.0/24 to Router:

[Plain]View Plaincopy
    1. # neutron Router-interface-add fce64ebe-47f0-4846-b3af-9cf764f1ff11 subnet=4a176b4e-a9b2-4bd8-a2e3-2dbe1aeaf890
    2. Added interface dc290da0-0aa4-4d96-9085-1f894cf5b160 to Router fce64ebe-47f0-4846-b3af-9cf764f1ff11.

At this point, we look at the network topology and discover that two networks are router through:



We can also find two network interfaces connected to the router as the gateway of their respective subnet.

We can see the namespace created for router.

[Plain]View Plaincopy
    1. # IP Netns List
    2. Qrouter-fce64ebe-47f0-4846-b3af-9cf764f1ff11
    3. Qdhcp-63b7fcf2-e921-4011-8da9-5fc2444b42dd
    4. qdhcp-5f833617-6179-4797-b7c0-7d420d84040c

We enter the namespace inside to see:

[Plain]View Plaincopy
  1. # IP netns exec qrouter-fce64ebe-47f0-4846-b3af-9cf764f1ff11 IP addr
  2. 1:LO:MTU 65536 qdisc noqueue State UNKNOWN
  3. Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00
  4. inet 127.0.0.1/8 Scope host Lo
  5. INET6:: 1/128 Scope Host
  6. Valid_lft Forever Preferred_lft Forever
  7. 20:QR-0B7B0B40-F9:MTU Qdisc Noqueue State UNKNOWN
  8. Link/ether FA:16:3E:82:47:A6 BRD FF:FF:FF:FF:FF:FF
  9. inet 10.10.10.1/24 BRD 10.10.10.255 Scope Global QR-0B7B0B40-F9
  10. Inet6 FE80::F816:3EFF:FE82:47A6/64 Scope link
  11. Valid_lft Forever Preferred_lft Forever
  12. 21:QR-DC290DA0-0A:MTU Qdisc Noqueue State UNKNOWN
  13. Link/ether fa:16:3e:c7:7c:9c BRD FF:FF:FF:FF:FF:FF
  14. inet 20.20.20.1/24 BRD 20.20.20.255 Scope Global qr-dc290da0-0a
  15. Inet6 FE80::F816:3EFF:FEC7:7C9C/64 Scope link
  16. Valid_lft Forever Preferred_lft Forever

We see two network interfaces, "qr-dc290da0-0a" and "qr-0b7b0b40-f9." The two network interfaces are connected to the OVS using two network/subnet gateway IPs.

[Plain]View Plaincopy
  1. # Ovs-vsctl Show
  2. 8a069c7c-ea05-4375-93e2-b9fc9e4b3ca1
  3. Bridge "Br-eth2"
  4. Port "Br-eth2"
  5. Interface "Br-eth2"
  6. Type:internal
  7. Port "Eth2"
  8. Interface "Eth2"
  9. Port "Phy-br-eth2"
  10. Interface "Phy-br-eth2"
  11. Bridge Br-ex
  12. Port Br-ex
  13. Interface Br-ex
  14. Type:internal
  15. Bridge Br-int
  16. Port "Int-br-eth2"
  17. Interface "Int-br-eth2"
  18. Port "qr-dc290da0-0a"
  19. Tag:2
  20. Interface "qr-dc290da0-0a"
  21. Type:internal
  22. Port "tap26c9b807-7c"
  23. Tag:1
  24. Interface "tap26c9b807-7c"
  25. Type:internal
  26. Port Br-int
  27. Interface Br-int
  28. Type:internal
  29. Port "Tap16630347-45"
  30. Tag:2
  31. Interface "Tap16630347-45"
  32. Type:internal
  33. Port "Qr-0b7b0b40-f9"
  34. Tag:1
  35. Interface "Qr-0b7b0b40-f9"
  36. Type:internal
  37. Ovs_version: "1.11.0"

As we can see, these interfaces are connected to "Br-int" and the VLAN tag corresponding to the network is located. Here we can successfully ping through router namespace via the gateway address (20.20.20.1):

We can also see that the IP address is 20.20.20.2 can ping the virtual machine with IP address 10.10.10.2:

Two subnet are interconnected through the network interfaces in the namespace. In namespace, neutron sets the system parameter Net.ipv4.ip_forward to 1. Commands are viewed as follows:

[Plain]View Plaincopy
    1. # IP netns exec qrouter-fce64ebe-47f0-4846-b3af-9cf764f1ff11 sysctl net.ipv4.ip_forward
    2. Net.ipv4.ip_forward = 1

We can see that the system parameter Net.ipv4.ip_forward is set in namespace, this setting does not affect the outside of namespace.

Summarize

When you create a router, neutron creates a namespace called qrouter-. The subnets is connected to router via a network interface on the OvS Br-int Bridge. The network interfaces are set up with the correct VLAN so that they can be connected to their corresponding networks. In the example, the IP of the network interface QR-0B7B0B40-F9 is set to the 10.10.10.1,vlan label of 1, which can be connected to "Net1". By setting the system parameter Net.ipv4.ip_forward to 1 in namespace, the route is allowed to take effect.

This article describes how to create a router using the network namespace. In the next article, we'll explore how floating IP works with iptables. This may be more complex, but it still uses these basic networking components.

Deep understanding of the OpenStack Network Architecture (3)-----Routing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.