1.修改ip、网关
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.20.34.254
=========================
2.修改DNS
sudo vi /etc/resolv.conf
=========================
nameserver 58.22.96.66
nameserver 210.34.48.34
domain localdomain
search localdomain
=========================
3.重启网络
sudo /etc/init.d/networking restart
4.如果重启网络服务出错
$ sudo service networking restart
SIOCSIFADDR: No such device eth0
这是由于udev服务在系统安装时,将网卡属性记录到本地文件中,克隆后新设备与原来存储的不一致,所以不能启动。
解决方法:删除本地文件,重启操作系统重新生成。
# 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
阅读(1351) | 评论(0) | 转发(0) |