01-网络管理器-全部.yaml

01-网络管理器-全部.yaml

我有一台 Ubuntu 20.04 Linux 桌面,它有四个以太网端口。两个端口未使用(将来我会使用全部四个端口),前两个端口现在正在使用。一个端口连接到调制解调器,因此 Linux 计算机可以访问互联网。第二个使用的端口连接了一个接入点。目的是让 Linux 计算机充当防火墙。所有流量都应通过它,人们连接到接入点。而不是将接入点直接连接到调制解调器。

Linux 计算机已成功通过调制解调器访问互联网。因此该部分工作正常。当接入点连接到调制解调器时,它就可以工作。因此,问题在于第二个以太网端口未绑定到以太网端口 1。

我已审查了以下内容: https://www.tecmint.com/configure-network-bonding-teaming-in-ubuntu

http://www.techpository.com/ubuntu-bond-two-network-cards-together

https://netplan.io/examples

但我还没有成功。我该如何解决这个问题?这样,如果我将一个或多个接入点连接到 Linux 机器,它就会使用端口 1/eth0/enp1s0 的以太网端口进行 Internet 访问?

01-网络管理器-全部.yaml

network:
    version: 2
    renderer: networkd
    ethernets:
      enp1s0: {}
      enp2s0: {}
    bonds:
        bond0:
            interfaces:
                - enp1s0
                - enp2s0
            parameters:
                mode: active-backup
                primary: enp1s0

sudo netplan--debug 生成

DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:551187): DEBUG: 07:29:35.573: starting new processing pass
** (generate:551187): DEBUG: 07:29:35.573: We have some netdefs, pass them through a final round of validation
** (generate:551187): DEBUG: 07:29:35.573: enp2s0: setting default backend to 1
** (generate:551187): DEBUG: 07:29:35.573: Configuration is valid
** (generate:551187): DEBUG: 07:29:35.573: enp1s0: setting default backend to 1
** (generate:551187): DEBUG: 07:29:35.573: Configuration is valid
** (generate:551187): DEBUG: 07:29:35.573: bond0: setting default backend to 1
** (generate:551187): DEBUG: 07:29:35.573: Configuration is valid
** (generate:551187): DEBUG: 07:29:35.574: Generating output files..
** (generate:551187): DEBUG: 07:29:35.574: openvswitch: definition enp1s0 is not for us (backend 1)
** (generate:551187): DEBUG: 07:29:35.574: NetworkManager: definition enp1s0 is not for us (backend 1)
** (generate:551187): DEBUG: 07:29:35.575: openvswitch: definition enp2s0 is not for us (backend 1)
** (generate:551187): DEBUG: 07:29:35.575: NetworkManager: definition enp2s0 is not for us (backend 1)
** (generate:551187): DEBUG: 07:29:35.575: openvswitch: definition bond0 is not for us (backend 1)
** (generate:551187): DEBUG: 07:29:35.575: NetworkManager: definition bond0 is not for us (backend 1)
(generate:551187): GLib-DEBUG: 07:29:35.575: posix_spawn avoided (fd close requested) 
(generate:551187): GLib-DEBUG: 07:29:35.590: posix_spawn avoided (fd close requested) 

dmesg|grep enp1s0

[    2.066296] igb 0000:01:00.0 enp1s0: renamed from eth0
[    4.116022] bond0: (slave enp1s0): Enslaving as a backup interface with an up link
[    4.158737] bond0: (slave enp1s0): making interface the new active one
[    7.110596] igb 0000:01:00.0 enp1s0: igb: enp1s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

dmesg|grep enp2s0

[    2.126761] igb 0000:02:00.0 enp2s0: renamed from eth1
[    4.088820] bond0: (slave enp2s0): making interface the new active one
[    4.089374] bond0: (slave enp2s0): Enslaving as an active interface with an up link
[    6.870442] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[12780.209083] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Down
[12783.073459] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[12806.913687] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Down
[12809.566095] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[28478.784219] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Down
[28481.500675] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[28505.101057] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Down
[28507.789427] igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX

相关内容