linux配置静态ip

  • A+
所属分类:linux

vi /etc/sysconfig/network-scripts/ifcfg-xxx

主要改动红色部分的基本上就可以了

DEVICE=eth0
HWADDR=00:0C:29:F5:1D:6A
TYPE=Ethernet
UUID=8f49ebc2-5b1b-4135-863b-6acb0c84453f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static #设置为静态,默认是DHCP 动态
IPADDR=192.168.11.139 #ip
NETMASK=255.255.255.0
GATEWAY=192.168.179.2#网关
DNS1=192.168.179.2 #配置网关连接外网

#source /etc/sysconfig/network-scripts/ifcfg-xxx

service network restart  #重新启动

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: