我正在尝试在我的 Ubuntu 22.04 上配置 USB 以太网适配器
user@host:~# ifconfig
enx806d970abd77: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::21fc:1eee:94e6:2a14 prefixlen 64 scopeid 0x20<link>
ether 80:6d:97:0a:bd:77 txqueuelen 1000 (Ethernet)
RX packets 108 bytes 18012 (18.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 772 bytes 133175 (133.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我可以通过执行以下命令为接口配置 IPv4 地址:
user@host:~# ip address add 11.1.1.1/24 dev enx806d970abd77
user@host:~# ifconfig
enx806d970abd77: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 11.1.1.1 netmask 255.255.255.0 broadcast 0.0.0.0
ether 80:6d:97:0a:bd:77 txqueuelen 1000 (Ethernet)
RX packets 108 bytes 18012 (18.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 858 bytes 147673 (147.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
但一段时间后(2-3 分钟)我丢失了配置的 IP 地址
# after sometime
user@host:~# ifconfig
enx806d970abd77: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::21fc:1eee:94e6:2a14 prefixlen 64 scopeid 0x20<link>
ether 80:6d:97:0a:bd:77 txqueuelen 1000 (Ethernet)
RX packets 108 bytes 18012 (18.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 772 bytes 133175 (133.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0