Configure network with netplan on Ubuntu
I installed new Ubuntu 19.10 server and realized that I need to use netplan to configure the network.
root@haifeli-ubuntu-1:/# cat /etc/issue Ubuntu 19.10 \n \l root@haifeli-ubuntu-1:/#
The following is my configuration.
Configure the IP address and DNS
root@haifeli-ubuntu-1:/# cat /etc/netplan/50-cloud-init.yaml # 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: ethernets: ens192: dhcp4: false addresses: [192.168.52.52/24] gateway4: 192.168.52.1 nameservers: addresses: [192.168.100.1] version: 2 root@haifeli-ubuntu-1:/#
Configure proxy
root@haifeli-ubuntu-1:/# cat /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" http_proxy="http://192.160.200.1:80" root@haifeli-ubuntu-1:/#
Save configuration
root@haifeli-ubuntu-1:/# netplan try Warning: Stopping systemd-networkd.service, but it can still be activated by: systemd-networkd.socket Do you want to keep these settings? Press ENTER before the timeout to accept the new configuration Changes will revert in 119 seconds Configuration accepted. root@haifeli-ubuntu-1:/#
We can also use apply to save directly.
root@haifeli-ubuntu-1:/# netplan apply
Recent Comments