1. modify ip address, Gateway sudovi/etc/network/interfaces # Theloopbacknetworkinterfaceautoloifaceloinetloopback # Theprimarynetworkinterfaceautoeth0 # eth0use...
1. modify the ip address and Gateway
Sudo vi/etc/network/interfaces
======================================
# The loopback network interface
Auto lo
Iface lo inet loopback
# The primary network interface
Auto eth0
# Eth0 use dhcp
# Iface eth0 inet dhcp
# Eth0 use static
Iface eth0 inet static
Address 172.20.35.21
Netmask 255.255.255.0
Gateway 172.000034.254
======================================
2. modify DNS
Sudo vi/etc/resolv. conf
======================================
Nameserver 58.22.96.66
Nameserver 210.34.48.34
Domain localdomain
Search localdomain
======================================
3. restart the network
Sudo/etc/init. d/networking restart
4. if an error occurs when the network service is restarted
$ Sudo service networking restart
SIOCSIFADDR: No such device eth0
This is because the udev service records the Nic attributes in the local file during system installation. after cloning, the new device is inconsistent with the original storage, so it cannot be started.
Solution: delete the local file and restart the operating system to regenerate the file.
# Ubuntu
Sudo mv/etc/udev/rules. d/70-persistent-net.rules/etc/udev/rules. d/70-persistent-net.rules.old
# Debian
Sudo mv/etc/udev/rules. d/z25_persistent-net.rules/etc/udev/rules. d/z25_persistent
Author hpwzd