ubuntu 17.10 set solid IP

After setting up the basic environment, you need to set a fixed IP, otherwise the IP will change every time I start, and I will go crazy every time I adjust the IP.

In Ubuntu 17.10, a new command is used to configure a static IP.

For this, we need to modify vim /etc/netplan/01-netcfg.yaml

Let's take a look at the content and format of the file:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version:2
 renderer: networkd
 ethernets:
 ens33:
  dhcp4: yes

We can see that the dhcp4 set here is yes. It means dhcp mode.

Okay, now we have to make changes. The following is the modified format:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version:2
 renderer: networkd
 ethernets:
 ens33:
  dhcp4: no
  dhcp6: no
  addresses:[192.168.110.231/24]
  gateway4:192.168.110.1
  nameservers:
   addresses:[114.114.114.114,8.8.8.8]

Now we explain the modified content:

If someone has set the static IP of windows or the static IP of the previous version of ubuntu, you may feel that one thing is missing, yes, it is the subnet mask.

This is /24. It is actually the set subnet mask. Below is the ip corresponding to the prefix, we can use this to set the response.

Prefix size subnet mask
/24 255.255.255.0
/25 255.255.255.128
/26 255.255.255.192
/27 255.255.255.224
/28 255.255.255.240
/29 255.255.255.248
/30 255.255.255.252

Well, after we modified the content of the configuration file according to the actual situation. Execute the following command to deploy:

sudo netplan apply

If there is no problem, the solid ip is set successfully. Then we reconfigure our xshell login ip, and just log in again.

Okay, isn't it very simple?

Recommended Posts

ubuntu 17.10 set solid IP
ubuntu16.04 set static ip
ubuntu 18.04 set static ip method
How to set static IP in ubuntu14.04
How to set static IP on Ubuntu 18.04 Server
ubuntu16.0.4 method to set a fixed IP address
How to set static IP on Ubuntu 18.04 Server
Explain how to set static IP on ubuntu14.04
ubuntu 14.04 configure 3-wire 3IP
ubuntu20.04 set static ip address (including different versions)
[Quick Start with Ubuntu] Two, Ubuntu set static IP
Ubuntu18.04, Centos7 static IP
ubuntu set Chinese font
How to set a fixed IP based on Ubuntu 16.04
Set static IP under Centos
ubuntu modify and configure ip address
How to set up Gogs on Ubuntu 14.04
Set UTF-8 encoding for MySQL5.7 in Ubuntu 16.04
How to set up R on Ubuntu 14.04
How to set PostgreSQL startup on Ubuntu 16.04
Set static IP for CentOS in VMware