我想在网络接口中“清理”。如果我运行ip addr
,我会得到以下列表(见文章底部)。
#2 和 #3 是我的 2 个物理网卡(#2 当前未插入),我在我的 netplan 配置中自己创建了 #5 和 #6。#10 ( docker0
) 对我来说也很有意义。
然而,其他大多数对我来说完全是个谜(例如,所有的虚拟以太网)。
有没有办法查看创建它们的服务以及它们是否正在使用?本质上,我是否可以安全地删除它们。我有点犹豫要不要sudo ip link delete INTERFACE
在不了解他们的情况下开始。
输出brctl show
:
bridge name bridge id STP enabled interfaces
br-870fc0691e90 8000.0242670e67e3 no veth3c7caf7
br-c43d0708a05e 8000.0242db5a4d9f no veth447ed70
br-f32d9d8a97b7 8000.024225ae37b1 no veth0174902
veth0b62e6b
veth3965e56
veth52593cf
veth589e856
veth6acd0d3
veth74d8b27
vethb06ec0c
vethb71f188
vethcd3e855
vethe5a1aae
vetheb8ac27
vethff7a086
br0 8000.329db9331ed5 yes eno1
vnet0
docker0 8000.0242c78c0ee3 no
virbr0 8000.5254002797d6 yes
输出ip addr
:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether 00:21:5e:c6:43:04 brd ff:ff:ff:ff:ff:ff
altname enp11s0f0
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 00:21:5e:c6:43:06 brd ff:ff:ff:ff:ff:ff
altname enp11s0f1
4: enx02215eca3baf: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 02:21:5e:ca:3b:af brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 32:9d:b9:33:1e:d5 brd ff:ff:ff:ff:ff:ff
inet 10.0.30.21/24 metric 100 brd 10.0.30.255 scope global dynamic br0
valid_lft 76838sec preferred_lft 76838sec
inet6 fe80::309d:b9ff:fe33:1ed5/64 scope link
valid_lft forever preferred_lft forever
6: vlan40@eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
link/ether 00:21:5e:c6:43:06 brd ff:ff:ff:ff:ff:ff
7: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:27:97:d6 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
8: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:26:69:40 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe26:6940/64 scope link
valid_lft forever preferred_lft forever
9: br-870fc0691e90: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:67:0e:67:e3 brd ff:ff:ff:ff:ff:ff
inet 172.20.0.1/16 brd 172.20.255.255 scope global br-870fc0691e90
valid_lft forever preferred_lft forever
inet6 fe80::42:67ff:fe0e:67e3/64 scope link
valid_lft forever preferred_lft forever
10: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:c7:8c:0e:e3 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
11: br-c43d0708a05e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:db:5a:4d:9f brd ff:ff:ff:ff:ff:ff
inet 172.11.0.1/24 brd 172.11.0.255 scope global br-c43d0708a05e
valid_lft forever preferred_lft forever
inet6 fe80::42:dbff:fe5a:4d9f/64 scope link
valid_lft forever preferred_lft forever
12: br-f32d9d8a97b7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:25:ae:37:b1 brd ff:ff:ff:ff:ff:ff
inet 172.21.0.1/16 brd 172.21.255.255 scope global br-f32d9d8a97b7
valid_lft forever preferred_lft forever
inet6 fe80::42:25ff:feae:37b1/64 scope link
valid_lft forever preferred_lft forever
14: vethb06ec0c@if13: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 72:08:f7:98:75:d2 brd ff:ff:ff:ff:ff:ff link-netnsid 4
inet6 fe80::7008:f7ff:fe98:75d2/64 scope link
valid_lft forever preferred_lft forever
16: veth3c7caf7@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-870fc0691e90 state UP group default
link/ether 2a:fb:a7:23:ef:a5 brd ff:ff:ff:ff:ff:ff link-netnsid 2
inet6 fe80::28fb:a7ff:fe23:efa5/64 scope link
valid_lft forever preferred_lft forever
18: veth447ed70@if17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-c43d0708a05e state UP group default
link/ether ca:3a:29:a8:ba:bd brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::c83a:29ff:fea8:babd/64 scope link
valid_lft forever preferred_lft forever
20: vethe5a1aae@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether a2:c1:db:43:c0:bd brd ff:ff:ff:ff:ff:ff link-netnsid 5
inet6 fe80::a0c1:dbff:fe43:c0bd/64 scope link
valid_lft forever preferred_lft forever
22: veth52593cf@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether ca:67:51:81:95:c5 brd ff:ff:ff:ff:ff:ff link-netnsid 3
inet6 fe80::c867:51ff:fe81:95c5/64 scope link
valid_lft forever preferred_lft forever
24: veth74d8b27@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 92:fa:e9:b0:13:d7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::90fa:e9ff:feb0:13d7/64 scope link
valid_lft forever preferred_lft forever
26: vethb71f188@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 0e:0e:da:df:15:98 brd ff:ff:ff:ff:ff:ff link-netnsid 6
inet6 fe80::c0e:daff:fedf:1598/64 scope link
valid_lft forever preferred_lft forever
28: veth0174902@if27: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 7e:e0:b1:76:d9:47 brd ff:ff:ff:ff:ff:ff link-netnsid 7
inet6 fe80::7ce0:b1ff:fe76:d947/64 scope link
valid_lft forever preferred_lft forever
30: veth3965e56@if29: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether b2:ca:05:df:1c:af brd ff:ff:ff:ff:ff:ff link-netnsid 9
inet6 fe80::b0ca:5ff:fedf:1caf/64 scope link
valid_lft forever preferred_lft forever
34: vethff7a086@if33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 6a:97:34:da:5d:2f brd ff:ff:ff:ff:ff:ff link-netnsid 10
inet6 fe80::6897:34ff:feda:5d2f/64 scope link
valid_lft forever preferred_lft forever
36: vetheb8ac27@if35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether f2:d3:47:65:5c:b0 brd ff:ff:ff:ff:ff:ff link-netnsid 11
inet6 fe80::f0d3:47ff:fe65:5cb0/64 scope link
valid_lft forever preferred_lft forever
38: veth0b62e6b@if37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 4e:05:42:a2:62:3d brd ff:ff:ff:ff:ff:ff link-netnsid 12
inet6 fe80::4c05:42ff:fea2:623d/64 scope link
valid_lft forever preferred_lft forever
40: veth6acd0d3@if39: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether b2:7e:7c:8c:85:b3 brd ff:ff:ff:ff:ff:ff link-netnsid 13
inet6 fe80::b07e:7cff:fe8c:85b3/64 scope link
valid_lft forever preferred_lft forever
42: veth589e856@if41: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether 0a:4e:7c:29:ba:3a brd ff:ff:ff:ff:ff:ff link-netnsid 14
inet6 fe80::84e:7cff:fe29:ba3a/64 scope link
valid_lft forever preferred_lft forever
72: vethcd3e855@if71: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-f32d9d8a97b7 state UP group default
link/ether f6:24:c0:75:e6:24 brd ff:ff:ff:ff:ff:ff link-netnsid 8
inet6 fe80::f424:c0ff:fe75:e624/64 scope link
valid_lft forever preferred_lft forever
这是 Ubuntu 服务器 LTS 22.04。
当您使用 docker 或容器甚至虚拟机时,每个容器或系统都必须有一个连接到网桥的虚拟以太网设备。
你展示了你使用 Docker,这也可能是你让网桥运行的原因,因为你使用的是
docker-compose
. 每个容器在主机系统上都有自己的veth
映射到容器的网络。您运行的 Docker 容器越多,veth
产生的设备就越多。如果您执行 a
docker-compose down
并关闭所有 Docker 容器,veth
设备数量将急剧减少。请注意,
enx
设备是由 mac 地址标识的设备。根据 SystemD 使用的可预测网络接口命名系统 ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ ),您可以很容易地找到它:
(强调我的)
您的
enx
设备是一个 MAC 地址为 02:21:5E:CA:3B:AF 的物理接口,并且安装在您的系统某处,无论是在系统内部还是通过 USB 加密狗等外部安装都无法分辨。