In Ubuntu 17.04 18.04 system versions, have enabled the latest netplan network tool that replaces the original network. Therefore, Ubuntu 17.04 and 18.04 systems for command-line parameters to configure the network with the previous version there are big differences.
So what, in Ubuntu 17.04 and 18.04 versions of them, set a static IP approach what is it? This article briefly to introduce the next.
Previous versions set a static IP is to modify the / etc / network / interfaces in.
The new version is to use the /etc/netplan/*.yaml command to be modified.
Check system version command: #lsb_release -a
The following quote a simple example:
Detailed test server NIC configuration file path:
/etc/netplan/01-network-manager-all.yaml
IP information:
IP address: 192.168.0.1
Mask: / 24
Gateway: 192.168.0.254
the DNS: 8.8.8.8 and 8.8.4.4
1. Use vi to edit the configuration file card
we /etc/netplan/01-network-manager-all.yaml
#Let NetworkManager manage all devices on this system
network:
version 2
#renderer: NetworkManager
ethernets:
ens33:
addresses: [192.168.0.1/24]
gateway4: 192.168.0.254
nameservers:
addresses: [8.8.8.8,8.8.4.4]
# Card file comments
, Ethernets:
ens33: NIC name # configuration
addresses: [192.168.0.111/24] # Set the local IP and mask
gateway4: 192.168.0.1 # Set the gateway
nameservers:
Addresses: [8.8.8.8, 8.8.4.4 ] # set DNS
2. The method of entry into force of the NIC configuration file
Execute the following command:
#netplan apply
If you are Ubuntu 17.04 and 18.04 version, then installing the above method can set a static IP, and if the previous version, it is still to be modified in accordance with the old method.
At present small series www.appjzw.com site uses a previous version, you do not need this setting later if the upgrade version, greatly accelerates the process of setting share information to everyone.