Add a new network interface to a ubuntu 20 vmware virtual machine¶
After you create a ubuntu 20 virtual machine, it will automatically discover and config the default network interface.
The problem is that, after we add a new network interface to it, the new interface will not be activated automatically and cannot be used immediately.
We will show you how to activate the new interface in the following example.
Find the new interface¶
In the virtual machine's terminal, execute the following command, and you will see all your interfaces.
ip a
Most interfaces have an ip address, the one without an ip address is probably your new interface.
In my own environment, lo
and ens33
both have an ip address, but ens38
does not have one. So, ens38
is the name of the new interface.
Add the new interface's name to the config file¶
Open file /etc/netplan/00-installer-config.yaml
, and you will see something like:
# This is the network config written by 'subiquity'
network:
ethernets:
ens33:
dhcp4: true
version: 2
It's a yaml file and contains all the activated interfaces. Here we already have the default interface ens33
in ethernets
section.
After we add the new interface ens38
to it, /etc/netplan/00-installer-config.yaml
will be like:
# This is the network config written by 'subiquity'
network:
ethernets:
ens33:
dhcp4: true
ens38:
dhcp4: true
version: 2
Make changes take effect¶
After we change the config file, execute the following command to take effect:
sudo netplan apply
About the config file's path¶
On older version of ubuntu, the config file's path is /etc/network/interfaces
and it has a different file format, do not use it. On Ubuntu20, we should use /etc/netplan/00-installer-config.yaml
.
This article is originally created by tooli.top. Please indicate the source when reprinting : https://www.tooli.top/posts/new_interface