查看虚拟机mac地址的方法 虚拟机mac地址怎么查( 二 )


BOOTPROTO=static #设置静态Ip
ONBOOT=yes #这里如果为no的话就改为yes,表示网卡设备自动启动
GATEWAY=192.168.137.1 #这里的网关地址就是VMnet8的IP地址
IPADDR=192.168.137.1 #配置ip,根据VMnet8的IP地址,此处设置ip处于192.168.137.xxx这个范围,只要不和网关相同均可
#NETMASK=255.255.255.0 #子网掩码
PREFIXO0=24 #设置子网掩码
DNS1=211.140.13.188 #dns服务器1,填写你所在的网络可用的dns服务器地址即可
DNS2=211.140.188.188 #dns服器2
子网掩码小解:
24位的意思就是24个二进制的1,是这样的:11111111.11111111.11111111.00000000,换算成十进制的表示就是:255.255.255.0
28位:11111111.11111111.11111111.11110000,换算成十进制为255.255.255.240
30位:11111111.11111111.11111111.11111100,换算成十进制为255.255.255.252
⑥ 配置完静态IP后重启网络服务
#systemctl restart network.service 或 service network restart
重启网络服务如果报错,解决方式如下: 第一种:和 NetworkManager 服务冲突,关闭NetworkManger 服务
# service NetworkManager stop,并且禁止开机启动 chkconfig NetworkManager off。
重启 。
第二种:和配置文件的MAC地址不匹配,修改 /etc/udev/rules.d/70-persistent-net.rules文件的MAC地址和 /etc/sysconfig/network-scripts/ifcfg-eth0一样就好了 。
第三种方法解决 Failed to start LSB: Bring up/down networking 问题
i.执行 service network restart 出现以下错误
Restarting network (via systemctl): Job for network.service failed. See ‘systemctl status network.service’ and ‘journalctl -xn’ for details.
ii.根据上面的提示,执行“systemctl status network.service”输出以下的类似信息:
[root@localhost ~]# systemctl status network.service
network.service – LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: failed (Result: exit-code) since Wed 2018-01-24 22:04:08 PST; 5min ago
Process: 5103 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
Process: 6056 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain network[6056]: RTNETLINK answers: File exists
Jan 24 22:04:08 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Jan 24 22:04:08 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Jan 24 22:04:08 localhost.localdomain systemd[1]: Unit network.service entered failed state.
iii.解决的办法(由于centos7中没有70-persistent-net.rules这个文件,复制出来的虚拟机(vmware)需要修改mac地址),就是修改mac地址 。
iv.如何查看centos7复制出来的虚拟机的mac地址,需要执行 “ip addr”,输出如下的类似信息:
[root@localhost ~]# ip addr show
1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP qlen 1000


以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!

「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助: