在 Linux guest 中配置网络适配器

在 Linux guest 中配置网络适配器

我通过 Virtualbox 使用 Windows 主机和 ubuntu 来宾。我配置了 2 个网络适配器。两者都是桥接的。第一个桥接至我的 wifi 网络适配器,第二个桥接至我的 USB 以太网适配器。 wifi适配器设置为dhcp,usb网络适配器设置为静态ip。我的问题是,在我的 Linux 客户机中,即使在接口中进行了配置,只有 wifi 适配器在启动后启动,而 USB 适配器则未启动。这是ifconfig -a输出:

lukasz@lukasz-vb:~$ ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.21.10.29  netmask 255.255.0.0  broadcast 172.21.255.255
        inet6 fe80::87e1:2aa6:bac0:b941  prefixlen 64  scopeid 0x20<link>
        inet6 2003:f0:9bcc:3500:5c07:9fa7:4423:f093  prefixlen 64  scopeid 0x0<global>
        inet6 2003:f0:9bcc:3500:d260:1f95:48fc:63af  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:6f:af:c4  txqueuelen 1000  (Ethernet)
        RX packets 33  bytes 2898 (2.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 69  bytes 10487 (10.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 08:00:27:f4:fd:65  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

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 50  bytes 4188 (4.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 50  bytes 4188 (4.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

第一个是通过 wifi 适配器,第二个是通过 USB 适配器。这是ifconfig

lukasz@lukasz-vb:~$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.21.10.29  netmask 255.255.0.0  broadcast 172.21.255.255
        inet6 fe80::87e1:2aa6:bac0:b941  prefixlen 64  scopeid 0x20<link>
        inet6 2003:f0:9bcc:3500:5c07:9fa7:4423:f093  prefixlen 64  scopeid 0x0<global>
        inet6 2003:f0:9bcc:3500:d260:1f95:48fc:63af  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:6f:af:c4  txqueuelen 1000  (Ethernet)
        RX packets 1801  bytes 137862 (137.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 74  bytes 10787 (10.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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 50  bytes 4188 (4.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 50  bytes 4188 (4.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

第二个适配器已关闭...

我尝试将其配置为etc/network/interfaces

lukasz@lukasz-vb:~$ cat /etc/network/interfaces 
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

# USB C ethrnet adapter static ip
auto enp0s8
iface enp0s8 inet static
      address 10.10.10.7
      netmask 255.0.0.0
      gateway 10.10.10.6

第一个(wifi)接口可以工作,即使它甚至没有在那里配置,我如何配置第二个?

相关内容