Configuring static IP for Ubuntu 16.04

Time:2021-7-27
  • View network card information
    Configuring static IP for Ubuntu 16.04

command

$ vim sudo vim /etc/network/interfaces
#Network card name
auto eno2
#Set to static IP
iface eno2 inet static
#IP address
address 192.168.33.61
#Subnet mask
netmask 255.255.255.0
#Gateway
gateway 192.168.33.1
#DNS server
dns-nameserver 8.8.8.8
  • Configure DNS server
$ sudo vim /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
nameserver 114.114.114.114
  • Refresh profile
$ sudo resolvconf -u
  • Restart the network
$ sudo /etc/init.d/networking restart

This work adoptsCC agreement, reprint must indicate the author and the link to this article