码迷,mamicode.com
首页 > 其他好文 > 详细

centos设置静态ip及出现的问题解决

时间:2016-12-01 15:08:55      阅读:644      评论:0      收藏:0      [点我收藏+]

标签:静态ip;centos

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

UUID=cb2546d2-05fa-44a2-ac1e-c8fa0a9c1c00

NM_CONTROLLED=yes

BOOTPROTO=none

USERCTL=no

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="eth0"

HWADDR=00:0C:29:C1:30:2A

PEERDNS=yes

PEERDNS=yes

IPADDR=192.168.208.104

NETMASK=255.255.255.0

DNS2=221.11.1.68

GATEWAY=192.168.208.2

DNS1=221.11.1.67

保存

service network restart

如果出现

[root@localhost ~]# service network restar

Shutting down interface eth0:  Device eth0 has MAC address 00:0C:29:C1:30:2A, instead of configured address 00:0C:29:F6:52:E4. Ignoring.

                                                           [FAILED]

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

Bringing up interface eth0:  Device eth0 has different MAC address than expected, ignoring.

                                                           [FAILED]

查看mac地址 cat /sys/class/net/eth0/address

编辑网卡配置文件vi /etc/sysconfig/network-scripts/ifcfg-eth0

修改HWADDR为执行cat /sys/class/net/eth0/address的结果

保存再重启网卡service network restart

[root@localhost ~]# service network restart 

Shutting down interface eth0:                              [  OK  ]

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

Bringing up interface eth0:  Determining if ip address 192.168.208.104 is already in use for device eth0...                                      [  OK  ]


centos设置静态ip及出现的问题解决

标签:静态ip;centos

原文地址:http://labulaka.blog.51cto.com/10037805/1878393

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!