linux固定ip地址

原文链接: http://www.cnblogs.com/SunshineKimi/p/10752480.html

最近自己搭jenkins发现ifconfig出来ip老是变来变去决定固定服务ip,原来配置:

[root@bogon bin]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:0C:29:F4:A4:5A"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="32f46724-9e38-4712-b088-29be2ae53bc4"
[root@bogon bin]#

修改BOOTPROTO=static 也就是动态dhcp域名解析动态分配ip改为静态

添加IPADDR=192.168.229.129到最后行也就是你的ip要固定的

完成后重启网络设配器:

service network restart

ifconfig 验证下效果:

[root@bogon bin]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/9
state: activated
Connection activated
[ OK ]
[root@bogon bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:F4:A4:5A
inet addr:192.168.229.129 Bcast:192.168.229.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef4:a45a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:547794 errors:0 dropped:0 overruns:0 frame:0

转载于:https://www.cnblogs.com/SunshineKimi/p/10752480.html

猜你喜欢

转载自blog.csdn.net/weixin_30511107/article/details/94862517