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

前端之家收集整理的这篇文章主要介绍了centos设置静态ip及出现的问题解决前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

[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 restart

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 ]

原文链接:https://www.f2er.com/centos/379656.html

猜你在找的CentOS相关文章