Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Configuring Static IP Addresses With Networkd
- To configure a static IP address using the new NetPlan tool, the file should look like this: IPv4 address (192.168.1.2), Gateway (192.168.1.1), DNS Servers (8.8.8.8,8.8.4.4)
- Run the commands below to create a new network configuration file
- `sudo nano /etc/netplan/01-netcfg.yaml`
- Then configure IPv4 addresses as shown below… take notes of the format the lines are written…
- _This file describes the network interfaces available on your system_
- _For more information, see netplan(5)._
- ```yaml
- network:
- version: 2
- renderer: networkd
- ethernets:
- ens33:
- dhcp4: no
- dhcp6: no
- addresses: [192.168.1.2/24]
- gateway4: 192.168.1.1
- nameservers:
- addresses: [8.8.8.8,8.8.4.4]
- ```
- Exit and save your changes by running the commands below
- `sudo netplan apply`
- You can add IPv6 addresses line, separated by a comma.. example below.
- _This file describes the network interfaces available on your system_
- _For more information, see netplan(5)._
- ```yaml
- network:
- version: 2
- renderer: networkd
- ethernets:
- ens33:
- dhcp4: no
- dhcp6: no
- addresses: [192.168.1.2/24, '2001:1::2/64']
- gateway4: 192.168.1.1
- nameservers:
- addresses: [8.8.8.8,8.8.4.4]
- ```
- Save your changes, apply and you’re done.
- This is how to set static IP addresses on Ubuntu 18.04.
Add Comment
Please, Sign In to add comment