- Open /etc/netplan/01-netcfg.yaml in your favorite text editor. For instance,
Code: Select all
nano /etc/netplan/01-netcfg.yaml
- Find the indented line that starts with "addresses:". It should look something like this:
Or, it may look like this:Code: Select all
addresses: [ 1.2.3.1/24, 1.2.3.4/24, 1.2.3.5/24 ]
Delete what is currently between the brackets, or just all of the IP addresses, if they are on separate lines as in the second format. Then, for each of the IP addresses listed on the "IP list" page,Code: Select all
addresses: - 1.2.3.1/24 - 1.2.3.4/24 - 1.2.3.5/24
- Start a new line, with spaces to line up with the "a" under the word "addresses", followed by a dash and another space.
- Type the IP address, followed by a slash.
- Look at the "netmask" column. If it reads "255.255.255.0", type a "24" after the slash. If it reads "255.255.254.0", type a "23" after the slash.
- If another IP address is listed that needs to be handled next, repeat the steps for each other IP address.
- Find the indented line that starts with "gateway4:". It should look something like this:
Replace the IP address with the first gateway listed on the IP list page. Only one gateway address needs to be entered.Code: Select all
gateway4: 1.2.3.254
- Save the file and exit the text editor. For instance, in nano, press Control-S, followed by Control-X.
- Type this command to reload the network:
Code: Select all
netplan apply
Ubuntu 18.04+ instructions (netplan)
- Edge100x
- Founder
- Posts: 13008
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Thu Apr 18, 2002 11:04 pm
- Location: Seattle
- Contact:
Ubuntu 18.04+ instructions (netplan)
Re: Ubuntu 18.04 instructions
For reference, here is an example default 01-netcfg.yaml file.
Code: Select all
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 1.2.3.4/24
gateway4: 1.2.3.254
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
- 1.1.1.1