How to add second extra network interface on Ubuntu 18.04 VM on OpenStack

0

I have a public interface on a Ubuntu 18.04 VM hosted by a provider that uses OpenStack. Now I want to add a second extra interface for the internal network. I'm not sure how to do that.

Using the web interface of the hosting provider I can add the internal network. After I add this I can see the network interface but no IP address is assigned. Reboot also doesn't help here.

So for example ip a shows

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether fa:16:3e:e7:0b:19 brd ff:ff:ff:ff:ff:ff
    inet (MY PUBLIC IP)/24 brd 185.110.173.255 scope global dynamic ens3
       valid_lft 84480sec preferred_lft 84480sec
    inet6 fe80::f816:3eff:fee7:b19/64 scope link 
       valid_lft forever preferred_lft forever
3: ens7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether fa:16:3e:e3:4f:3f brd ff:ff:ff:ff:ff:ff

My public ip shows up but the interface I added gets no IP address.

I added the ens7 interface to /etc/netplan/50-cloud-init.yaml as follows

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: fa:16:3e:e7:0b:19
            set-name: ens3
        ens7:
            dhcp4: true
            match:
                macaddress: fa:16:3e:e3:4f:3f
            set-name: ens7

When I run netplan apply my SSH connection is immediately disconnected and I can no longer access the machime from the internet.

When I use the console and run ip a I see exactly the results I expected however. ens3 has the correct public IP and ens7 has the correct private ip.

I also have a Ubuntu 16.04 VM. Using that cloud image I was able to do this by editing /etc/network/interfaces.d/50-cloud-init.cfg and adding

auto eth1
iface eth1 inet dhcp

But now I want to do something similar on Ubuntu 18.04 VM.

Why am I unable to access the machine using SSH from the internet? IP configuration looks okay.

What is the correct way to add a VM to a second internal private network when using an Ubuntu 18.04 cloud image on OpenStack?

BTW, I am using Ubuntu cloud image bionic-server-cloudimg-amd64.img

onknows

Posted 2019-08-27T07:49:31.037

Reputation: 475

No answers