嘿朋友们。我今天就这个问题设置了另一个主题,但现在我收到了更多信息,并且我得到了一些进展,所以它几乎与旧的没有任何关系。在 Fedora 31 上创建网桥的过程中我一直很挣扎,但最终我让它工作了。我大概学习了 10 个教程,但现在或多或少已经可以工作了。我的目标是将虚拟机传递到本地网络,因此我希望网络 brdige br0 使用网络的 dhcp 服务器获取我的计算机的 IP 地址。简单的路由器。不幸的是出了问题,我无法找到解决方案。
我的nmcli connection show
输出如下
[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
Bridge br0 d2d68553-f97e-7549-7a26-b34a26f29318 bridge br0
enp0s3 da37a9c2-f5a5-3a8a-b3ab-4ecd96031402 ethernet enp0s3
virbr0 898b66b6-22e1-4e46-9065-2fd67158731c bridge virbr0
enp0s8 00cb8299-feb9-55b6-a378-3fdc720e0bc6 ethernet enp0s8
enp0s8 是我想用于 br0 桥的接口。所以我有 2 个物理网络接口连接到物理局域网。
所以我尝试把所有内容都提出来,看起来不错,但不幸的是,在获取 IP 地址时,该过程似乎被卡住了。此外,获取有关此主题的信息非常困难,因此如果没有解决方案,我将不得不付费给某人,但我确信有人能够提供帮助:)
Jan 27 21:42:43 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 27 21:42:43 localhost.localdomain NetworkManager[930]: <info> [1580157763.0113] device (enp0s8): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jan 27 21:42:43 localhost.localdomain NetworkManager[930]: <info> [1580157763.0117] device (enp0s8): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jan 27 21:42:43 localhost.localdomain NetworkManager[930]: <info> [1580157763.0137] device (enp0s8): Activation: successful, device activated.
Jan 27 21:42:43 localhost.localdomain systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive.
Jan 27 21:42:53 localhost.localdomain systemd[1]: NetworkManager-dispatcher.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The unit NetworkManager-dispatcher.service has successfully entered the 'dead' state.
Jan 27 21:42:53 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <warn> [1580157808.3501] dhcp4 (br0): request timed out
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3502] dhcp4 (br0): state changed unknown -> timeout
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3567] dhcp4 (br0): canceled DHCP transaction
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3568] dhcp4 (br0): state changed timeout -> done
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3571] device (br0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <warn> [1580157808.3589] device (br0): Activation: failed for connection 'Bridge br0'
Jan 27 21:43:28 localhost.localdomain audit: ANOM_PROMISCUOUS dev=enp0s8 prom=0 old_prom=256 auid=4294967295 uid=0 gid=0 ses=4294967295
Jan 27 21:43:28 localhost.localdomain kernel: device enp0s8 left promiscuous mode
Jan 27 21:43:28 localhost.localdomain kernel: br0: port 1(enp0s8) entered disabled state
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3766] device (br0): detached bridge port enp0s8
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3791] device (enp0s8): state change: activated -> deactivating (reason 'dependency-failed', sys-iface-state: 'managed')
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3814] device (br0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.3854] policy: auto-activating connection 'Bridge br0' (d2d68553-f97e-7549-7a26-b34a26f29318)
Jan 27 21:43:28 localhost.localdomain systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: A start job for unit NetworkManager-dispatcher.service has begun execution
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A start job for unit NetworkManager-dispatcher.service has begun execution.
--
-- The job identifier is 3027.
Jan 27 21:43:28 localhost.localdomain systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: A start job for unit NetworkManager-dispatcher.service has finished successfully
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A start job for unit NetworkManager-dispatcher.service has finished successfully.
--
-- The job identifier is 3027.
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=raw family=2 entries=52
Jan 27 21:43:28 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=mangle family=2 entries=67
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=nat family=2 entries=106
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=filter family=2 entries=189
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=raw family=10 entries=55
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=mangle family=10 entries=66
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=nat family=10 entries=101
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=filter family=10 entries=193
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.4138] device (br0): state change: disconnected -> unmanaged (reason 'user-requested', sys-iface-state: 'managed')
Jan 27 21:43:28 localhost.localdomain NetworkManager[930]: <info> [1580157808.4159] device (enp0s8): state change: deactivating -> disconnected (reason 'dependency-failed', sys-iface-state: 'managed')
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=raw family=2 entries=51
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=mangle family=2 entries=66
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=nat family=2 entries=104
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=filter family=2 entries=186
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=raw family=10 entries=54
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=mangle family=10 entries=65
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=nat family=10 entries=99
Jan 27 21:43:28 localhost.localdomain audit: NETFILTER_CFG table=filter family=10 entries=190
Jan 27 21:43:38 localhost.localdomain systemd[1]: NetworkManager-dispatcher.service: Succeeded.
这里是 Cockpit GUI 的可能更有用的日志
21:49
<info> [1580158169.5541] device (enp0s8): state change: deactivating -> disconnected (reason 'dependency-failed', sys-iface-state: 'managed')
NetworkManager
21:49
<info> [1580158169.5527] device (br0): state change: disconnected -> unmanaged (reason 'user-requested', sys-iface-state: 'managed')
NetworkManager
21:49
<info> [1580158169.5155] policy: auto-activating connection 'Bridge br0' (d2d68553-f97e-7549-7a26-b34a26f29318)
NetworkManager
21:49
<info> [1580158169.5130] device (br0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
NetworkManager
21:49
<info> [1580158169.5109] device (enp0s8): state change: activated -> deactivating (reason 'dependency-failed', sys-iface-state: 'managed')
NetworkManager
21:49
<info> [1580158169.5090] device (br0): detached bridge port enp0s8
NetworkManager
21:49
<warn> [1580158169.4982] device (br0): Activation: failed for connection 'Bridge br0'
NetworkManager
21:49
<info> [1580158169.4974] manager: startup complete
NetworkManager
21:49
<info> [1580158169.4969] device (br0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
NetworkManager
21:49
<info> [1580158169.4966] dhcp4 (br0): state changed timeout -> done
NetworkManager
当我编辑该/etc/sysconfig/network-scripts/ifcfg-br0
文件时,BOOTPROTO=dhcp
对其进行更改BOOTPROTO=none
会收到 IPv6 地址,但不会收到 IPv4 地址。
我尝试分配一个静态IP,它有效,但我不明白很多网络知识,尤其是像虚拟机和网桥这样复杂的东西。现在有一个 IP 分配给 br0 接口,但虚拟机内部仍然没有互联网连接。
192.168.2.133/24, 2001:4dd6:6675:0:8022:44ff:fe0c:7261/64, fe80:0:0:0:8022:44ff:fe0c:7261/64
编辑:
今天我尝试使用 Cockpit Web 界面建立一个桥接器,之后ip addr show
看起来nmcli connection show
像这样,但不幸的是虚拟机内部没有互联网连接
Last login: Tue Jan 28 11:23:04 2020 from 192.168.2.49
[root@localhost ~]# brctl show
bridge name bridge id STP enabled interfaces
bridge0 8000.eaa2ae14ae08 yes enp0s8
[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
enp0s3 da37a9c2-f5a5-3a8a-b3ab-4ecd96031402 ethernet enp0s3
bridge0 c9243687-2904-4ee8-9d0a-bf1818fc4705 bridge bridge0
enp0s8 00cb8299-feb9-55b6-a378-3fdc720e0bc6 ethernet enp0s8
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:14:57:8e brd ff:ff:ff:ff:ff:ff
inet 192.168.2.128/24 brd 192.168.2.255 scope global dynamic noprefixroute enp0s3
valid_lft 863374sec preferred_lft 863374sec
inet6 2001:4dd1:6569:0:8d77:52a:b667:6cf6/64 scope global dynamic noprefixroute
valid_lft 7129sec preferred_lft 3529sec
inet6 fe80::7802:956e:eee2:dde8/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bridge0 state UP group default qlen 1000
link/ether 08:00:27:f3:a8:5a brd ff:ff:ff:ff:ff:ff
8: bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ea:a2:ae:14:ae:08 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.150/24 brd 192.168.2.255 scope global noprefixroute bridge0
valid_lft forever preferred_lft forever
inet6 2001:4dd1:6569:0:bf80:325c:ded7:6f92/64 scope global dynamic noprefixroute
valid_lft 7129sec preferred_lft 3529sec
inet6 fe80::669:9515:8a22:dce2/64 scope link noprefixroute
valid_lft forever preferred_lft forever
现在,在重置所有内容并创建新桥之后,IPv4 地址被分配给虚拟机,但在虚拟机内部我无法获得任何网络或 Internet 访问权限。
主机名也出现在局域网内部。
ip addr show
[root@localhost images]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:14:57:8e brd ff:ff:ff:ff:ff:ff
inet 192.168.2.128/24 brd 192.168.2.255 scope global dynamic noprefixroute enp0s3
valid_lft 860261sec preferred_lft 860261sec
inet6 2001:4dd1:6569:0:a58a:c00c:a13e:430/64 scope global dynamic noprefixroute
valid_lft 7196sec preferred_lft 3596sec
inet6 fe80::73d7:3c65:50ab:a960/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bridge0 state UP group default qlen 1000
link/ether 08:00:27:f3:a8:5a brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:43:41:4e brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether d2:bd:8e:48:b7:6d brd ff:ff:ff:ff:ff:ff
6: bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 16:fa:f3:41:a9:f3 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.150/24 brd 192.168.2.255 scope global noprefixroute bridge0
valid_lft forever preferred_lft forever
inet6 2001:4dd1:6569:0:35d5:4679:9565:86a/64 scope global dynamic noprefixroute
valid_lft 7196sec preferred_lft 3596sec
inet6 fe80::4aae:e40c:fd54:62a6/64 scope link noprefixroute
valid_lft forever preferred_lft forever
12: macvtap0@bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:c4:10:78 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fec4:1078/64 scope link
valid_lft forever preferred_lft forever
macvtap0 已自动创建,并且具有与虚拟机相同的 MAC。