我有 Ubuntu 18.04 和 PCI 以太网电缆(已连接)。当我启动机器时,它总是尝试打开 USB 以太网连接。我可以使用屏幕右上角的菜单关闭此功能,但这种关闭不是持久的:下次重新启动时,它会再次尝试打开 USB 以太网连接。
我怎样才能永久关闭它?
编辑:添加了一些输出
输出lsusb
:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 04f2:b51d Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 8087:0a2b Intel Corp.
Bus 001 Device 003: ID 03f0:9d1d Hewlett-Packard
Bus 001 Device 002: ID 046d:c050 Logitech, Inc. RX 250 Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
输出lspci
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Device 9d11 (rev f1)
00:1c.3 PCI bridge: Intel Corporation Device 9d13 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V (rev 21)
01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
EDIT2:输出ip link show
(ifconfig -a |grep Link
不产生输出)
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 10:e7:c6:6c:59:b3 brd ff:ff:ff:ff:ff:ff
3: enp0s20f0u3c2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 26:b7:4e:09:a6:4a brd ff:ff:ff:ff:ff:ff
4: wlp2s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 68:ec:c5:c0:78:e4 brd ff:ff:ff:ff:ff:ff
编辑 3:输出sudo lshw -class network
*-network DISABLED
description: Wireless interface
product: Wireless 8260
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 3a
serial: 68:ec:c5:c0:78:e4
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-34-generic firmware=34.0.1 latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:128 memory:e1100000-e1101fff
*-network
description: Ethernet interface
product: Ethernet Connection I219-V
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
logical name: enp0s31f6
version: 21
serial: 10:e7:c6:6c:59:b3
size: 100Mbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.13-4 ip=134.96.90.25 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:125 memory:e1200000-e121ffff
*-network
description: Ethernet interface
physical id: 2
logical name: enp0s20f0u3c2
serial: 72:63:21:bf:e2:28
capabilities: ethernet physical
configuration: broadcast=yes driver=cdc_ether driverversion=22-Aug-2005 firmware=CDC Ethernet Device link=yes multicast=yes
PS:在 Ubuntu 20.04 下行为仍然相同
答案1
8 年前有人问过类似的问题(也是悬赏):启动时禁用无线
接受的答案是:
禁用该卡的方法有很多种。我认为最简单的方法是:
sudo ifdown enp0s20f0u3c2
在您的/etc/rc.local
上面exit 0
。这应该禁用无线网卡(wlan0
用您的无线接口卡替换)
如果您想在按下键盘时启用/禁用,Ubuntu 论坛上的这个帖子解释了如何将键盘事件链接到脚本。如果您想在按下按键时切换,则必须向脚本添加一些逻辑。不过最简单的方法可能是让一个键启用,另一个键禁用。
向下脚本
#!/bin/bash
IFACE=enp0s20f0u3c2
ifconfig ${IFACE} down
及以上脚本
#!/bin/bash
IFACE=enp0s20f0u3c2
ifconfig ${IFACE} up