1, first check the card name: I was ens33
ifconfig
2, modify the network card configuration file
sudo vi /etc/network/interfaces
Add the following:
auto ens33
iface ens33 inet static
address 192.168.0.23
netmask 255.255.255.0
gateway 192.168.0.1
3, modify the DNS
sudo gedit /etc/resolve.conf
Add the following:
nameserver 8.8.8.8
4. Restart
sudo /etc/init.d/networking restart