我有一张带有 4 个以太网端口的网卡。我尝试使用其中 2 个,1 个用于主系统,1 个用于 LXC 容器。当我查找有关如何将 eth1 接口专用于容器的教程时,它们都告诉我首先打开我的 /etc/network/interfaces 文件,但该文件不存在。我只有 3 个目录,并且没有一个有接口文件。我在互联网上找不到与此相关的任何内容。
user@server:/etc/network$ ls -a
. .. if-post-down.d if-pre-up.d if-up.d
user@server:/etc/network$ ls -aR
.:
. .. if-post-down.d if-pre-up.d if-up.d
./if-post-down.d:
. .. bridge
./if-pre-up.d:
. .. bridge ethtool mtuipv6
./if-up.d:
. .. ethtool mtuipv6
Ubuntu 版本:
user@server:~/$ lsb_release -d
Description: Ubuntu 19.04
user@server:~$ cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eno1:
dhcp4: true
version: 2
user@server:~$ sudo lshw -C network
[sudo] password for user:
*-network:0
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:01:00.0
logical name: eno1
version: 20
serial: 00:26:b9:45:6e:8b
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=full firmware=7.8.16 bc 7.4.0 NCSI 2.0.13 ip=10.0.0.13 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:32 memory:d6000000-d7ffffff
*-network:1 DISABLED
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
physical id: 0.1
bus info: pci@0000:01:00.1
logical name: eno2
version: 20
serial: 00:26:b9:45:6e:8d
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=half firmware=7.8.16 bc 7.4.0 NCSI 2.0.13 latency=0 link=no multicast=yes port=twisted pair
resources: irq:33 memory:d8000000-d9ffffff
*-network:0 DISABLED
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:02:00.0
logical name: eno3
version: 20
serial: 00:26:b9:45:6e:8f
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=half firmware=7.8.16 bc 7.4.0 NCSI 2.0.13 latency=0 link=no multicast=yes port=twisted pair
resources: irq:34 memory:da000000-dbffffff
*-network:1 DISABLED
description: Ethernet interface
product: NetXtreme II BCM5709 Gigabit Ethernet
vendor: Broadcom Inc. and subsidiaries
physical id: 0.1
bus info: pci@0000:02:00.1
logical name: eno4
version: 20
serial: 00:26:b9:45:6e:91
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=half firmware=7.8.16 bc 7.4.0 NCSI 2.0.13 latency=0 link=no multicast=yes port=twisted pair
resources: irq:35 memory:dc000000-ddffffff
*-network:0
description: Ethernet interface
physical id: 1
logical name: docker0
serial: 02:42:63:a1:44:18
capabilities: ethernet physical
configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=no multicast=yes
*-network:1
description: Ethernet interface
physical id: 2
logical name: br-135ff2e86e4b
serial: 02:42:fa:bc:d2:a8
capabilities: ethernet physical
configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.19.0.1 link=no multicast=yes
*-network:2
description: Ethernet interface
physical id: 3
logical name: br-ca014f092875
serial: 02:42:e3:a1:3f:9e
capabilities: ethernet physical
configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.18.0.1 link=no multicast=yes
*-network:3
description: Ethernet interface
physical id: 4
logical name: lxcbr0
serial: 00:16:3e:00:00:00
capabilities: ethernet physical
configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=10.0.1.1 link=no multicast=yes