linux修改ip

ip地址设置
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0c:29:cc:fe:bd
IPV6INIT=yes
ONBOOT=yes
IPADDR=192.168.16.151
NETMASK=255.255.255.0
GATEWAY=192.168.16.1

DNS设置
vi /etc/resolv.conf
search localdomain
nameserver 202.106.195.68
nameserver 202.106.0.20

sudo /etc/init.d/network restart   重新启动网卡

你可能感兴趣的:(c,linux)