Use the command to set the Ubuntu IP address
1. Modify the configuration file blacklist.conf to disable IPV6
sudo vi /etc/modprobe.d/blacklist.conf
It means to edit the content of the blacklist.conf file in the modprobe.d folder under the etc folder with the vi editor (or other editors, such as gedit).
Note: It can only be modified in root user mode
Add blacklist ipv6 at the end of the document
Then view the modified results
cat /etc/modprobe.d/blacklist.conf
2. Set the IP address and subnet mask of the network card eth0
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0
Change the IP address to: 192.168.2.1, and the subnet mask to: 255.255.255.0
3. Ubuntu IP setting gateway
sudo route add default gw 192.168.2.254
4. Ubuntu IP settings DNS modify /etc/resolv.conf, add nameserver DNS address 1 and nameserver DNS address 2 to complete.
5. Restart the network service (if not, please restart ubuntu: sudo reboot)