系统环境:
VMware虚拟机安装的RHEL7.0的linux系统,创建了两个网卡,一个为host-only状态,一个为桥接状态,分别如下图所示:
其中仅主机模式用来和vmware中其他主机进行内网通讯,桥接模式用来上外网。
问题描述:
配置好仅主机模式的连接为静态IP以后启用成功,配置桥接模式连接也配置成功,但是启用连接的时候会一直卡住,然后出现如下超时提示。
[root@station100 ~]# nmcli connection show
NAME UUID TYPE DEVICE
public 613b7ef9-c59b-4e88-bd0c-fa8eafaee764 802-3-ethernet eno50332216
private c5b0bd34-3e6a-4d6c-b34f-d73da7592aa6 802-3-ethernet eno16777736
[root@station100 ~]# nmcli connection up public
Error: Timeout 90 sec expired.
解决步骤:
1、动态查看journal日志,发现如下日志信息:
[root@station100 etc]# journalctl -f
-- Logs begin at Mon 2020-03-09 00:55:48 CST. --
Mar 09 01:11:47 station100.example.com NetworkManager[3412]: <info> Activation (eno33...
Mar 09 01:11:47 station100.example.com NetworkManager[3412]: <info> Activation (eno33...
Mar 09 01:27:50 station100.example.com NetworkManager[3412]: DHCPDISCOVER on eno33554992 to 255.255.255.255 port 67 interval 20 (xid=0x315cc95a)
Mar 09 01:28:10 station100.example.com dhclient[5198]: DHCPDISCOVER on eno33554992 to 255.255.255.255 port 67 interval 21 (xid=0x315cc95a)
Mar 09 01:28:10 station100.example.com NetworkManager[3412]: DHCPDISCOVER on eno33554992 to 255.255.255.255 port 67 interval 21 (xid=0x315cc95a)
Mar 09 01:28:17 station100.example.com NetworkManager[3412]: **<warn> (eno33554992): DHCPv4 request timed out.**
Mar 09 01:28:17 station100.example.com NetworkManager[3412]: <info> (eno33554992): canceled DHCP transaction, DHCP client pid 5198
Mar 09 01:28:17 station100.example.com NetworkManager[3412]: <info> Activation (eno33554992) Stage 4 of 5 (IPv4 Configure Timeout) scheduled...
2、通过以上分析发现dhcp获取ip地址超时导致故障发生,进入“虚拟网络编辑器”查看桥接网络配置情况如下,发现vmnet0默认未自动桥接状态,未桥接到物理网卡:
3、手动指定桥接网卡为笔记本无线网卡:
4、再次重新启动桥接网络连接,连接启动成功,外网也能连通:
[root@station100 ~]# nmcli connection up public
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)
[root@station100 ~]# ip a
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
link/ether 00:0c:29:93:28:07 brd ff:ff:ff:ff:ff:ff
inet 172.16.30.100/24 brd 172.16.30.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe93:2807/64 scope link
valid_lft forever preferred_lft forever
4: eno50332216: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:93:28:1b brd ff:ff:ff:ff:ff:ff
inet 192.168.43.184/24 brd 192.168.43.255 scope global dynamic eno50332216
valid_lft 2308sec preferred_lft 2308sec
inet6 240e:ff:b181:b923:20c:29ff:fe93:281b/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe93:281b/64 scope link
valid_lft forever preferred_lft forever
[root@station100 ~]# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
64 bytes from 114.114.114.114: icmp_seq=1 ttl=92 time=472 ms
64 bytes from 114.114.114.114: icmp_seq=2 ttl=93 time=135 ms
64 bytes from 114.114.114.114: icmp_seq=3 ttl=89 time=73.0 ms
64 bytes from 114.114.114.114: icmp_seq=4 ttl=73 time=104 ms
64 bytes from 114.114.114.114: icmp_seq=5 ttl=84 time=136 ms
问题总结:
故障问题比较简单,主要注意虚拟机配置桥接网络的时候记得选择需要桥接的网卡,需要上网的时候选择桥到能上网的网卡上去。