linux固定ip地址

最近自己搭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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值