Practical 10: OpenStack User Network and Private Network
Aim
Create an OpenStack project and user. Add a private network, a subnet and a router linked to the external network. Start two instances, check their IP (Internet Protocol) addresses and test their connections. Draw the network layout.
Theory
Neutron manages networks in OpenStack. A project, also called a tenant, groups a team's resources. Each project can have its own private network.
A subnet is an IP address range within a network. A router connects networks. An instance is a running virtual server.
Your private network is the society's internal road – houses (VMs (Virtual Machines)) on it can visit each other directly. The router is the main gate that lets residents go out to the city (Internet). A floating IP is like a public house number on the main road – it lets outsiders come in to one particular house. The security group is the watchman who decides who may enter.
flowchart LR
I((Internet)) --- P["public (external) network<br/>172.24.4.0/24"]
P --- R["lab-router<br/>gateway 172.24.4.x · SNAT"]
R --- S["lab-net / lab-subnet<br/>192.168.50.0/24 · DHCP"]
S --- A["vm-a<br/>192.168.50.x<br/>+ floating IP"]
S --- B["vm-b<br/>192.168.50.y"]
| Neutron object | Purpose |
|---|---|
| Network | An isolated layer-2 segment (VXLAN (Virtual Extensible Local Area Network)/VLAN (Virtual Local Area Network)) owned by a project – the private "road" |
| Subnet | The IP range, gateway, DHCP (Dynamic Host Configuration Protocol) and DNS (Domain Name System) settings for a network |
| Router | Connects subnets; its external gateway gives SNAT (Source Network Address Translation) so VMs can reach the Internet |
| Port | A virtual network card on a network (one per instance interface) |
| Floating IP | A public address mapped 1:1 (NAT (Network Address Translation)) to an instance's port – allows incoming access |
| Security group | A stateful firewall per port (by default it blocks incoming traffic) |
Identity (Keystone) terms
| Term | Meaning |
|---|---|
| Project (tenant) | The owner of resources and the boundary for quotas |
| User | An identity that logs in |
| Role | What the user may do in a project (member, admin, reader) |
Instances on the same tenant network talk directly (layer 2). To reach the Internet they need a router with an external gateway (SNAT for outgoing traffic). To be reached from the Internet they need a floating IP and security-group rules.
Requirements
- OpenStack (DevStack) with Keystone, Nova, Neutron and Glance; admin login details (
admin-openrc.sh) - The CirrOS image and the flavor
m1.tiny
Procedure
Step 1 – Create the tenant and user (as admin)
source admin-openrc.sh
openstack project create --description "Networking practical" labnet
openstack user create --password secret --project labnet netuser
openstack role add --project labnet --user netuser member
- Load the admin login, create the project
labnet, create usernetuser, and give them thememberrole in that project.
Step 2 – Switch to the tenant user
source devstack/openrc netuser labnet
From now on, everything you create belongs to labnet.
Step 3 – Create the private network and subnet
openstack network create lab-net
openstack subnet create lab-subnet --network lab-net \
--subnet-range 192.168.50.0/24 --dns-nameserver 8.8.8.8
lab-netis the private road;lab-subnetgives it the address range 192.168.50.0/24 and the DNS server 8.8.8.8.
Step 4 – Create the router to the external network
openstack router create lab-router
openstack router set lab-router --external-gateway public
openstack router add subnet lab-router lab-subnet
- Create the router (main gate), connect it to the
publicnetwork, and connect it to our subnet.
Step 5 – Open the security group
In the default security group, allow ICMP (Internet Control Message Protocol) (ping) and SSH (Secure Shell) (port 22).
Step 6 – Launch two instances
openstack server create vm-a --image cirros-0.6.2-x86_64-disk --flavor m1.tiny --network lab-net
openstack server create vm-b --image cirros-0.6.2-x86_64-disk --flavor m1.tiny --network lab-net
openstack server list
Both VMs get a private address (192.168.50.x) from DHCP.
Step 7 – Add a floating IP and test
openstack floating ip create public
openstack server add floating ip vm-a 172.24.4.x
ssh cirros@172.24.4.x # password gocubsgo
ip a # 192.168.50.x on eth0
ping -c 3 192.168.50.y # vm-b – private network
ping -c 3 8.8.8.8 # internet through the router
- Get a floating IP and attach it to
vm-a, then SSH in through it. ip a– shows the private address inside the VM.- First ping – VM to VM on the private road.
- Second ping – out to the Internet through the router.
Virtual lab · OpenStack · 40 min
Practical 10: OpenStack tenant user and private network topology
As cloud admin, create a tenant project and user; as that user build a private network, subnet and router to the external network, launch two instances, give one a floating IP and prove private and internet connectivity from inside the instance.
Output / Observations
Example output for the settings in this lesson:
| Object | Value |
|---|---|
| Project / user / role | labnet / netuser / member |
| Network / subnet | lab-net / 192.168.50.0/24, gateway 192.168.50.1, DHCP on |
| Router | lab-router – external gateway public, interface on lab-subnet |
| Instances | vm-a 192.168.50.x (+ floating IP), vm-b 192.168.50.y |
| Tests | vm-a → vm-b: 0% loss · vm-a → 8.8.8.8: 0% loss |
Conclusion
Check that both instances receive private IP addresses and can communicate as allowed by their security rules. Assign a floating IP and test external access. Compare the working network with your drawing.
Viva questions
- What is the difference between a network and a subnet in Neutron? A network is the L2 segment; a subnet defines the IP range, gateway and DHCP on it.
- Why does an instance need a router to reach the internet? The router's external gateway does SNAT from the private range to the public network.
- What does a floating IP add? Incoming reachability through 1:1 NAT from a public address.
- Why could
vm-apingvm-bwithout a floating IP? They share the same tenant network, so the traffic stays inside it. - Which service manages users and projects? Keystone.
- What does the
memberrole allow? Creating and managing resources inside the project, but not cloud-wide admin actions.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.