通过桥梁连接虚拟机和外界

通过桥梁连接虚拟机和外界

目前正在设置一个虚拟机(通过 AWS Firecracker,但这应该没关系,它只是在客户机中获取tap0并使用它),它应该连接到外部世界。我已将主机通过连接到互联网,我认为连接到路由器/互联网的最简单方法就是将其桥接到,我也已将其插入路由器。eth0eno1tap0eno2

目前我已将设置为和br0的主控。我已确认这三个都是在 VM 运行时。但在 VM 内部,没有连接。eno2tap0UP

主持人ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 44:a8:42:37:bd:b2 brd ff:ff:ff:ff:ff:ff
    altname enp2s0f0
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 44:a8:42:37:bd:b3 brd ff:ff:ff:ff:ff:ff
    altname enp2s0f1
4: eno3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 44:a8:42:37:bd:b4 brd ff:ff:ff:ff:ff:ff
    altname enp3s0f0
5: eno4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 44:a8:42:37:bd:b5 brd ff:ff:ff:ff:ff:ff
    altname enp3s0f1
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
    link/ether 02:42:b0:9e:8a:18 brd ff:ff:ff:ff:ff:ff
29: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether fe:fc:4a:0d:d1:5e brd ff:ff:ff:ff:ff:ff
30: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 16:70:91:24:35:7a brd ff:ff:ff:ff:ff:ff

主持人bridge link

3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 5
30: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 100

客人ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether aa:fc:ff:00:00:00 brd ff:ff:ff:ff:ff:ff

我认为它在第 2 层没有正确连接,因为什么都没有显示,启动时ip route show它会卡住很长时间,尽管据我所知我的设置是正确的,但没有 IP 地址。以下是我的帮助:Raise network interfaces.../etc/network/interfaceseth0/etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

我很不擅长社交,所以我可能做错了什么,而我认为“完成”eno2而不是“eno1完成其他所有事情”的假设可能是错误的。任何帮助我都会很感激!

相关内容