1、配置DNS
vi /etc/resolv.conf
加入
nameserver 192.168.0.1
nameserver 8.8.8.8
2、配置网关
vi /etc/sysconfig/network
加入
GATEWAY=192.168.0.1
完整如下:
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.0.1
3、配置IP地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
内容如下
DEVICE="eth0"
HWADDR="00:0C:29:6C:BB:E6"
NM_CONTROLLED="yes"
BOOTPROTO=static
ONBOOT=yes
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.8
GATEWAY=192.168.0.1
DNS1=192.168.0.1
4、重启network服务
/etc/init.d/network restart
或使用命令:
service network restart
或:
ifdown eth0 and ifup eth0
时间: 2024-10-12 18:56:51