lichengbei
2019-10-19
1. Modify the network configuration file:
root@ubuntu-lichengbei:~# vim /etc/network/interfaces
It reads as follows:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # interface auto ens38 iface ens38 inet static address 192.168.0.2 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 auto ens33 iface ens33 inet static address 32.14.0.2 netmask 255.255.0.0 network 32.14.0.0 broadcast 32.14.255.255 # nameserver dns-nameservers 223.5.5.5 dns-nameservers 223.6.6.6 # route up route add -net 35.0.0.0 netmask 255.0.0.0 gw 32.14.0.2 dev ens33
Note: The only be assigned to a network port Gateway , the system generates a default route
2.reboot take effect (also can restart the network service networking restart to take effect)
3. Network Command Reference:
ifconfig -a
ifconfig eth0 192.168.1.56 netmask 255.255.255.0
ip addr flush dev eht0
ifconfig eth0 down
ifconfig eth0 up