1.配置/etc/network/interfaces
vi /etc/network/interfaces
设置为如下
# 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
auto eth0
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
gateway 192.168.0.1
2配置DNS
vi /etc/resolv.conf
修改为
domain
nameserver 202.101.226.69
nameserver 202.101.224.69
3重启服务
执行/etc/init.d/networking restart
重启服务就能上网了