Linux 虚拟网络 - 无互联网连接

Linux 虚拟网络 - 无互联网连接

我创建了虚拟网络,但是无法用它连接到互联网。

sudo ip link add name br0 type veth peer name br1
sudo ip link set br0 up

我正在检查:

curl --interface br0 https://google.com

我没有收到任何响应,它似乎永远运行下去。它适用于wlan0docker0。我的ifconfig输出:

br0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.99.37  netmask 255.255.255.0  broadcast 0.0.0.0
        ether e2:9e:ae:91:95:0b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-132c631d3bbd: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 170.1.0.1  netmask 255.255.0.0  broadcast 170.1.255.255
        ether 02:42:38:b8:3f:e9  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-34dd1b78e566: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.2.0.1  netmask 255.255.0.0  broadcast 172.2.255.255
        ether 02:42:4b:1b:a0:19  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-7c4e5f3070d3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.22.0.1  netmask 255.255.0.0  broadcast 172.22.255.255
        ether 02:42:9c:0d:e1:03  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-9a0efb052e8b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.21.0.1  netmask 255.255.0.0  broadcast 172.21.255.255
        inet6 fe80::42:74ff:fef0:8edb  prefixlen 64  scopeid 0x20<link>
        ether 02:42:74:f0:8e:db  txqueuelen 0  (Ethernet)
        RX packets 1753  bytes 79501 (79.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2276  bytes 199843 (199.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-9c9b12e29a42: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:d2:12:9f:24  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-a1f93290d33a: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.28.0.1  netmask 255.255.0.0  broadcast 172.28.255.255
        ether 02:42:7e:71:17:80  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-a2414f32a107: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.20.0.1  netmask 255.255.0.0  broadcast 172.20.255.255
        ether 02:42:34:59:f8:b2  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-a3aa6cb6ea5a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.4.0.1  netmask 255.255.0.0  broadcast 172.4.255.255
        inet6 fe80::42:43ff:fe33:9e46  prefixlen 64  scopeid 0x20<link>
        ether 02:42:43:33:9e:46  txqueuelen 0  (Ethernet)
        RX packets 780  bytes 42092 (42.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 736  bytes 68948 (68.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-d4be9df32e9d: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 173.5.0.1  netmask 255.255.0.0  broadcast 173.5.255.255
        ether 02:42:10:d0:73:1b  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-d5a17e857f15: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.0.0.1  netmask 255.255.0.0  broadcast 172.0.255.255
        ether 02:42:0a:1e:7b:09  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-d749273cc449: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.19.0.1  netmask 255.255.0.0  broadcast 172.19.255.255
        ether 02:42:be:7e:04:dd  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-e43afc1e9586: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.29.0.1  netmask 255.255.0.0  broadcast 172.29.255.255
        ether 02:42:6d:4d:75:d9  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-e8519f4a7990: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.32.1  netmask 255.255.240.0  broadcast 192.168.47.255
        ether 02:42:d2:db:8b:b0  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.42.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:10:14:77:fc  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 84:7b:eb:39:96:f0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xef300000-ef320000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 12580  bytes 5001059 (5.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12580  bytes 5001059 (5.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth15db121: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::5ca8:4bff:fece:6d85  prefixlen 64  scopeid 0x20<link>
        ether 5e:a8:4b:ce:6d:85  txqueuelen 0  (Ethernet)
        RX packets 4  bytes 236 (236.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 2900 (2.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethae8fe12: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2451:73ff:fefd:9a91  prefixlen 64  scopeid 0x20<link>
        ether 26:51:73:fd:9a:91  txqueuelen 0  (Ethernet)
        RX packets 780  bytes 53012 (53.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 785  bytes 74218 (74.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.38  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 2a02:a312:c646:b200:991e:3864:638c:44f4  prefixlen 64  scopeid 0x0<global>
        inet6 2a02:a312:c646:b200:9a4b:a1e3:41f5:ea42  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::4570:1039:9de6:cb4d  prefixlen 64  scopeid 0x20<link>
        ether e4:b3:18:20:b0:9d  txqueuelen 1000  (Ethernet)
        RX packets 132451  bytes 171502959 (171.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 36144  bytes 5762748 (5.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我究竟做错了什么?

相关内容