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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos设置静态ip及出现的问题解决相关的知识,希望对你有一定的参考价值。

[[email protected] ~]# 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

如果出现

[[email protected] ~]# 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

[[email protected] ~]# 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及出现的问题解决的主要内容,如果未能解决你的问题,请参考以下文章

Xshell 连接不上Linux Centos 7的解决方法之设置静态IP

Xshell 连接不上Linux Centos 7的解决方法之设置静态IP

CentOS7.9虚拟机修改静态ip无法上网ping不通出现Name or service not known问题如何解决?

CentOS7.9虚拟机修改静态ip无法上网ping不通出现Name or service not known问题如何解决?

CentOS7.9虚拟机修改静态ip无法上网ping不通出现Name or service not known问题如何解决?

CentOS6.5设置静态IP、网关、配置DNS,解决ping不通外网问题