Linux命令行修改IP、网关、DNS的方法

2019-10-14 15:04:03于海丽
网卡eth0    IP修改为 102.168.0.1  
ifconfig eth0 102.168.0.1 netmask 255.255.255.0
网关修改为 102.168.0.254
route add default gw 102.168.0.254
Linux命令行修改DNS
echo "nameserver 202.202.202.20 ">> /etc/resolv.conf
重启网络服务
service network restart

/etc/rc.d/init.d/network restrart