Step 1: Enter ip addr to display IP information:
You can see that the ip is now 192.168.1.13 and is a dynamic ip.
The second step is to enter route -n to print out the routing table and find out the gateway number:
The gateway is 192.168.1.1
Step 3: vim /etc/netplan/00-installer-config.yaml, edit the yaml file. Note that administrator rights are required here.
Save and exit.
Step 4: Enter the command netplan apply to make the changes take effect, then reboot the system and the configuration is complete.
Step 5: Check whether we have changed the dynamic ip to a static ip. Enter ip addr and the display will be as follows, then it is successful! ! !