ubuntu17 server set static ip

Edit the file: vim /etc/netplan/01-netcfg.yaml 

Add the following:

dhcp4: no 

dhcp6: no

addresses: [192.168.7.132]

gateway4: 192.168.7.2

nameservers:

    addresses: [192.168.7.2]

Note that there is a space after each semicolon (:)

Execute the command to make the modification take effect: netplan apply 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324927342&siteId=291194637