This section offers a brief overview of networking concepts for Compute.
Compute assigns a private IP address to each VM instance. (Currently, Compute with
nova-network
only supports Linux bridge
networking that enables the virtual interfaces to connect to the outside network through
the physical interface.) Compute makes a distinction between fixed IPs and floating IPs. Fixed IPs
are IP addresses that are assigned to an instance on creation and stay the same until
the instance is explicitly terminated. By contrast, floating IPs are addresses that can
be dynamically associated with an instance. A floating IP address can be disassociated
and associated with another instance at any time. A user can reserve a floating IP for
their project.
The network controller with nova-network
provides virtual networks to enable compute servers to interact with each other and with
the public network. Compute with nova-network
supports the following network modes, which are implemented as “Network Manager”
types.
- Flat Network Manager
In Flat mode, a network administrator specifies a subnet. IP addresses for VM instances are assigned from the subnet, and then injected into the image on launch. Each instance receives a fixed IP address from the pool of available addresses. A system administrator must create the Linux networking bridge (typically named
br100
, although this is configurable) on the systems running thenova-network
service. All instances of the system are attached to the same bridge, and this is configured manually by the network administrator.Note Configuration injection currently only works on Linux-style systems that keep networking configuration in
/etc/network/interfaces
.- Flat DHCP Network Manager
In FlatDHCP mode, OpenStack starts a DHCP server (
dnsmasq
) to allocate IP addresses to VM instances from the specified subnet, in addition to manually configuring the networking bridge. IP addresses for VM instances are assigned from a subnet specified by the network administrator.Like Flat Mode, all instances are attached to a single bridge on the compute node. Additionally, a DHCP server is running to configure instances (depending on single-/multi-host mode, alongside each
nova-network
). In this mode, Compute does a bit more configuration in that it attempts to bridge into an ethernet device (flat_interface
, eth0 by default). For every instance, Compute allocates a fixed IP address and configures dnsmasq with the MAC/IP pair for the VM. Dnsmasq does not take part in the IP address allocation process, it only hands out IPs according to the mapping done by Compute. Instances receive their fixed IPs by doing a dhcpdiscover. These IPs are not assigned to any of the host's network interfaces, only to the VM's guest-side interface.In any setup with flat networking, the hosts providing the
nova-network
service are responsible for forwarding traffic from the private network. They also run and configurednsmasq
as a DHCP server listening on this bridge, usually on IP address 10.0.0.1 (see DHCP server: dnsmasq ). Compute can determine the NAT entries for each network, although sometimes NAT is not used, such as when configured with all public IPs or a hardware router is used (one of the HA options). Such hosts need to havebr100
configured and physically connected to any other nodes that are hosting VMs. You must set theflat_network_bridge
option or create networks with the bridge parameter in order to avoid raising an error. Compute nodes have iptables/ebtables entries created for each project and instance to protect against IP/MAC address spoofing and ARP poisoning.Note In single-host Flat DHCP mode you will be able to ping VMs through their fixed IP from the
nova-network
node, but you cannot ping them from the compute nodes. This is expected behavior.- VLAN Network Manager
VLANManager mode is the default mode for OpenStack Compute. In this mode, Compute creates a VLAN and bridge for each tenant. For multiple-machine installation, the VLAN Network Mode requires a switch that supports VLAN tagging (IEEE 802.1Q). The tenant gets a range of private IPs that are only accessible from inside the VLAN. In order for a user to access the instances in their tenant, a special VPN instance (code named cloudpipe) needs to be created. Compute generates a certificate and key for the user to access the VPN and starts the VPN automatically. It provides a private network segment for each tenant's instances that can be accessed through a dedicated VPN connection from the Internet. In this mode, each tenant gets its own VLAN, Linux networking bridge, and subnet.
The subnets are specified by the network administrator, and are assigned dynamically to a tenant when required. A DHCP Server is started for each VLAN to pass out IP addresses to VM instances from the subnet assigned to the tenant. All instances belonging to one tenant are bridged into the same VLAN for that tenant. OpenStack Compute creates the Linux networking bridges and VLANs when required.
These network managers can co-exist in a cloud system. However, because you cannot select the type of network for a given tenant, you cannot configure multiple network types in a single Compute installation.
All network managers configure the network using network
drivers. For example, the Linux L3 driver (l3.py
and
linux_net.py
), which makes use of iptables
,
route
and other network management facilities, and libvirt's
network filtering
facilities. The driver is not tied to any particular network manager; all
network managers use the same driver. The driver usually initializes (creates bridges
and so on) only when the first VM lands on this host node.
All network managers operate in either single-host
or multi-host mode. This choice greatly influences
the network configuration. In single-host mode, a single nova-network
service provides a default gateway for VMs and hosts a
single DHCP server (dnsmasq
). In multi-host mode, each compute
node runs its own nova-network
service. In both
cases, all traffic between VMs and the outer world flows through nova-network
. Each mode has its pros and cons (see the
Network Topology section in the OpenStack Operations Guide.
Note | |
---|---|
All networking options require network connectivity to be already set up
between OpenStack physical nodes. OpenStack does not configure any physical network
interfaces. All network managers automatically create VM virtual interfaces. Some,
but not all, managers create network bridges such as
All machines must have a public and internal network interface
(controlled by the options:
The internal network interface is used for communication with VMs; the interface should not have an IP address attached to it before OpenStack installation (it serves merely as a fabric where the actual endpoints are VMs and dnsmasq). Also, you must put the internal network interface in promiscuous mode, because it must receive packets whose target MAC address is of the guest VM, not of the host. Throughout this documentation, the public network is sometimes referred to as the external network, while the internal network is also sometimes referred to as the private network or tenant network. |
For flat and flat DHCP modes, use the following command to create a network:
$ nova network-create vmnet \ --fixed-range-v4=10.0.0.0/24 --fixed-cidr=10.20.0.0/16 --bridge=br100
Where:
--fixed-range-v4-
specifies the network subnet.--fixed-cidr
specifies a range of fixed IP addresses to allocate, and can be a subset of the--fixed-range-v4
argument.--bridge
specifies the bridge device to which this network is connected on every compute node.