Skip to content
maricaantonacci edited this page Nov 22, 2014 · 12 revisions

Flat Public Network Configuration

Configuration

The following procedure allows to create an external flat network in OpenStack shared between all the tenants, aside a (already configured) standard setup with GRE tunnels. In this way it is possible to directly assign public IPs to the VMs, without having to use floating IPs, together with private ones.

A second NIC attached to the public network (here called eth2) is needed on the network node and on all compute nodes. Create the bridge br-ex2 and attach it to eth2:

# ovs-vsctl add-br br-ex2
# ovs-vsctl add-port br-ex2 eth2

and if you want to assign an IP address to it:

# ip a add <IP_PUB>/24 dev br-ex2

Modify the file /etc/network/interfaces as follows

# The public network interface adapted for OpenStack bridge br-ex
auto eth2
iface eth2 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down

# OpenStack external bridge 2
auto br-ex2
iface br-ex2 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down

Alternatively, you may want to assign an IP address to the bridge, if you need to reach the machine from that interface:

# OpenStack external bridge 2
auto br-ex2
iface br-ex2 inet static
address $2ND_INTERFACE_PUBLIC_IP
netmask $2ND_INTERFACE_NETMASK
gateway $2ND_INTERFACE_GATEWAY_IP
dns-nameservers $2ND_INTERFACE_DNS
dns-search $2ND_INTERFACE_DOMAIN
broadcast $2ND_INTERFACE_BROADCAST

Restart the network services:

# ifdown ethX && ifup ethX

for all the interfaces, or (better) reboot.

Modify the Open vSwitch Neutron plugin configuration files for the mapping bridge - physical network (on network and compute nodes)

Modify the file /etc/neutron/plugins/ml2/ml2_conf.ini according to the one shown in the repository and restart the Neutron services.

If you want to have two public networks, (one for the floating IPs and the gateways of the virtual routers, and the other for the public IPs directly assigned to the VMs), it is necessary to set the ID of the external network to be used to allocate the gateways of the virtual router. Add the following line to the file /etc/neutron/l3_agent.ini on the network node (replace $EXT_NET_ID with the id of the ext-net, obtainable with the command neutron net-list | grep ext):

gateway_external_network_id = $EXT_NET_ID

The ID must be the one of the external network (ext-net) used with GRE tunneling (the one used for the floating IPs and the gateways of the virtual routers), not the one we want to assign public IPs from (public-net). The network addresses of ext-net and public net MUST be different.

Network creation

Create the flat network public-net (replace $ADMIN_TENANT_ID with the id of the admin tenant):

# neutron net-create --debug --tenant-id $ADMIN_TENANT_ID --provider:network_type=flat --provider:physical_network=physnet1 --router:external True --shared public-net

and the subnet, without DHCP. At this point it is possible to instantiate VMs assigning public IPs from public-net.

Clone this wiki locally