临时IP:立即生效 重启失效 ifconfig eth0 192.168.1.8 netmask 255.255.255.0 route add default gw 192.168.1.1 ------------------------------------------------------ 永久生效 编辑 /etc/sysconfig/network-scripts/ifcfg-eth0 ,内容如下
DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.1.8 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 HWADDR=00:15:5D:E4:A2:BE ONBOOT=yes TYPE=Ethernet ------------------------------------------------------ 设置dns 编辑 /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 ------------------------------------------------------ 重启网卡 service network restart
|