Linux静态IP设置

IP配置:
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:26:18:0B:38:C0
ONBOOT=yes
IPADDR=192.168.0.20
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
IP生效:
/sbin/ifdown eth0
/sbin/ifup eth0

通知网关更新信息:
/etc/init.d/network restart

配置DNS:
vi /etc/resolv.conf
nameserver 202.96.134.133

解决重启生效:
chattr +i /etc/resolv.conf
改为只读

你可能感兴趣的:(linux)