我已按照指南设置并运行桥接网络
https://help.ubuntu.com/community/KVM/Installation
和
https://help.ubuntu.com/community/KVM/Networking
我的设置与这个问题类似: KVM 桥接网络不工作,但我可以使用其 IP 成功 ssh 进入客户机。
当我创建第二个设备时,按照与之前相同的过程(接受的答案中的过程)这个问题),它也能正常工作:我可以 ping 它,也可以 ssh 进入它。问题是两台客户机不能同时工作。如果一台有网络,另一台就没有,反之亦然。
我的网络中的所有计算机都从 DHCP 服务器接收 IP,并且如果我的客户端不是同时开启的,它就会成功地将 IP 分配给我的客户端。
如果我希望同时桥接客人,我是否应该以不同的方式创建客人?
有关我的设置的详细信息:
ifconfig
br0 Link encap:Ethernet HWaddr 00:23:ae:8b:0e:6d
inet addr:192.168.14.111 Bcast:192.168.14.255 Mask:255.255.255.0
inet6 addr: fe80::223:aeff:fe8b:e6d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2203 errors:0 dropped:0 overruns:0 frame:0
TX packets:678 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:200635 (200.6 KB) TX bytes:231362 (231.3 KB)
eth0 Link encap:Ethernet HWaddr 00:0a:cd:1c:71:fd
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:23:ae:8b:0e:6d
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2191 errors:0 dropped:0 overruns:0 frame:0
TX packets:792 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:234455 (234.4 KB) TX bytes:248498 (248.4 KB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:963 errors:0 dropped:0 overruns:0 frame:0
TX packets:963 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:295031 (295.0 KB) TX bytes:295031 (295.0 KB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:4f:df:90
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vnet0 Link encap:Ethernet HWaddr fe:54:00:6a:11:7f
inet6 addr: fe80::fc54:ff:fe6a:117f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26 errors:0 dropped:0 overruns:0 frame:0
TX packets:941 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:2516 (2.5 KB) TX bytes:91292 (91.2 KB)
vnet1 Link encap:Ethernet HWaddr fe:54:00:bc:8c:ed
inet6 addr: fe80::fc54:ff:febc:8ced/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42 errors:0 dropped:0 overruns:0 frame:0
TX packets:919 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:7988 (7.9 KB) TX bytes:85304 (85.3 KB)
cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth1
iface eth1 inet manual
auto br0
iface br0 inet dhcp
bridge_ports eth1
bridge_stp off
bridge_fd 0
bridge_maxwait 0
# post-up ip link set br0 address 00:23:ae:8b:0e:6d
brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0023ae8b0e6d no eth1
vnet0
vnet1
virbr0 8000.5254004fdf90 yes virbr0-nic
ip route
default via 192.168.14.1 dev br0
169.254.0.0/16 dev br0 scope link metric 1000
192.168.14.0/24 dev br0 proto kernel scope link src 192.168.14.111
192.168.100.0/24 dev virbr0 proto kernel scope link src 192.168.100.1
我正在使用的eth1
,eth0
是一张未使用的第二张网卡。
ifconfig
第一个虚拟机的为:
eth0 Link encap:Ethernet HWaddr 52:54:00:bc:8c:ed
inet addr:192.168.14.150 Bcast:192.168.14.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:febc:8ced/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26341 errors:0 dropped:9 overruns:0 frame:0
TX packets:13142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35241526 (35.2 MB) TX bytes:905257 (905.2 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1184 (1.1 KB) TX bytes:1184 (1.1 KB)
ifconfig
第二台虚拟机的为:
eth0 Link encap:Ethernet HWaddr 52:54:00:17:cc:ef
inet addr:192.168.14.148 Bcast:192.168.14.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe17:ccef/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29695 errors:0 dropped:11 overruns:0 frame:0
TX packets:13566 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35556206 (35.5 MB) TX bytes:944517 (944.5 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1184 (1.1 KB) TX bytes:1184 (1.1 KB)
当一台机器同时运行时,它们工作正常,但无法同时对两台机器执行 ping 操作。连接似乎在它们之间跳转,优先选择在网络上忙于工作的那台机器。
答案1
这是一个硬件问题。
我实验的服务器有以下网卡(来自lshw -C network
):
*-network
description: Ethernet interface
product: RTL-8100/8101L/8139 PCI Fast Ethernet Adapter
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: eth0
version: 10
serial: 00:0a:cd:1c:71:fd
size: 10Mbit/s
capacity: 100Mbit/s
width: 32 bits
clock: 33MHz
capabilities: pm bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=8139too driverversion=0.9.28 duplex=half latency=64 link=no maxlatency=64 mingnt=32 multicast=yes port=MII speed=10Mbit/s
resources: irq:26 ioport:cc00(size=256) memory:dfbff000-dfbff0ff
我在一台较新的计算机上重复了与问题中描述的完全相同的设置,并配备了以下网卡:
*-network
description: Ethernet interface
product: 82579LM Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 05
serial: 90:b1:1c:81:83:be
size: 100Mbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k duplex=full firmware=0.13-4 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:44 memory:fbf00000-fbf1ffff memory:fbf29000-fbf29fff ioport:f040(size=32)
网桥按预期工作;两个虚拟机现在都作为物理设备出现在网络上,并且同时工作。