不确定这是 netplan 中的错误还是预期的行为。
我已尝试使用裸机和 VMware Workstation 14.x 进行此操作,USB 和 PCI WiFi 卡均具有与 Lan 卡相同的 Mac 地址,最终导致连接问题。
在运行 Windows 或 Linux 的其他计算机上,该命令arp -a
将显示重复的 Mac 地址,如果我没记错的话,arp -a
连接 WiFi 后会立即显示正确的 Mac,但不到一小时后就会显示 Lan Mac。
我将下面的配置文件复制并粘贴到论坛中,我向你保证,运行后没有出现任何错误sudo netplan generate
,sudo netplan apply
任何格式错误都是由于论坛造成的。
network:
version: 2
renderer: networkd
ethernets:
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.200.99/24, 192.168.200.3/24]
nameservers:
addresses: [ 8.8.8.8, 1.1.1.1]
# WiFi Static
network:
version: 2
renderer: networkd
wifis:
wlx666:
dhcp4: no
dhcp6: no
optional: true
addresses: [192.168.200.21/24]
gateway4: 192.168.200.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
access-points:
MyAcessPointSSID:
password: password123456
编辑:添加 arp 结果
在 Ubuntu 18.04 服务器上设置 Wifi 之前
## Ubuntu 18.04 server
pi11@sml:~$ arp -a
TVremote (192.168.200.221) at 0c:b3:19(remoed) [ether] on ens33
TV9 (192.168.200.9) at 94:e9:79(remoed) [ether] on ens33
LEDE (192.168.200.1) at 30:b5:c2(remoed) [ether] on ens33
Media (192.168.200.101) at 4c:72:b9(remoed) [ether] on ens33
i5 (192.168.200.105) at 10:60:4b(remoed) [ether] on ens33
## Windows 10 computer
PS C:\Users\Owner> arp -a
Interface: 192.168.200.105 --- 0x9
Internet Address Physical Address Type
192.168.200.1 30-b5-c2(remoed) dynamic
192.168.200.9 94-e9-79(remoed) dynamic
192.168.200.11 00-0c-29(remoed) dynamic
192.168.200.13 20-6a-8a(remoed) dynamic
192.168.200.101 4c-72-b9(remoed) dynamic
192.168.200.255 ff-ff-ff(remoed) static
## Openwrt 18.06.1 router/gateway
root@LEDE:~# arp -a
IP address HW type Flags HW address Mask Device
192.168.200.12 0x1 0x0 00:00:00(remoed) * br-lan
192.168.1.254 0x1 0x0 00:00:00(remoed) * wan
192.168.1.1 0x1 0x2 84:1b:5e(remoed) * wan
192.168.200.9 0x1 0x2 94:e9:79(remoed) * br-lan
192.168.200.11 0x1 0x2 00:0c:29(remoed) * br-lan # Ubuntu 18.04 server Lan
192.168.200.105 0x1 0x2 10:60:4b(remoed) * br-lan
192.168.200.221 0x1 0x2 0c:b3:19(remoed) * br-lan
192.168.1.102 0x1 0x0 00:00:00(remoed) * wan
192.168.200.13 0x1 0x2 20:6a:8a(remoed) * br-lan
192.168.200.101 0x1 0x2 4c:72:b9(remoed) * br-lan
在 Ubuntu 18.04 服务器上设置 Wifi 后
## Ubuntu 18.04 server
pi11@sml:~$ arp -a
LEDE (192.168.200.1) at 30:b5:c2:(remoed) [ether] on ens33
i5 (192.168.200.105) at 10:60:4b:(remoed) [ether] on ens33
LEDE (192.168.200.1) at 30:b5:c2:(remoed) [ether] on wlxd666
Media (192.168.200.101) at 4c:72:b9:(remoed) [ether] on ens33
? (192.168.200.60) at <incomplete> on ens33
? (192.168.200.60) at <incomplete> on wlxd666
## Windows 10 computer
PS C:\Users\Owner> arp -a
Interface: 192.168.200.105 --- 0x9
Internet Address Physical Address Type
192.168.200.1 30-b5-c2-(remoed) dynamic
192.168.200.9 94-e9-79-(remoed) dynamic
192.168.200.11 00-0c-29-(remoed) dynamic # Ubuntu 18.04 server Lan
192.168.200.13 20-6a-8a-(remoed) dynamic
192.168.200.21 00-0c-29-(remoed) dynamic # Ubuntu 18.04 server WiFi
192.168.200.101 4c-72-b9-(remoed) dynamic
192.168.200.175 00-0c-29-(remoed) dynamic # Ubuntu 18.04 server WiFi
192.168.200.255 ff-ff-ff-(remoed) static
## Openwrt 18.06.1 router/gateway
root@FLOWER:~# arp -a
IP address HW type Flags HW address Mask Device
192.168.200.12 0x1 0x0 00:00:00:(remoed) * br-lan
192.168.1.254 0x1 0x0 00:00:00:(remoed) * wan
192.168.1.1 0x1 0x2 84:1b:5e:(remoed) * wan
192.168.200.9 0x1 0x2 94:e9:79:(remoed) * br-lan
192.168.200.11 0x1 0x2 00:0c:29:(remoed) * br-lan # Ubuntu 18.04 server
192.168.200.105 0x1 0x2 10:60:4b:(remoed) * br-lan
192.168.200.221 0x1 0x2 0c:b3:19:(remoed) * br-lan
192.168.1.102 0x1 0x0 00:00:00:(remoed) * wan
192.168.200.13 0x1 0x2 20:6a:8a:(remoed) * br-lan
192.168.200.101 0x1 0x2 4c:72:b9:(remoed) * br-lan
192.168.200.21 0x1 0x2 00:0c:29:(remoed) * br-lan # Ubuntu 18.04 server
设置完成后,Wifi 卡从我的 DHCP 服务器获得了另一个 IP 地址
pi11@sml:~$ ip -br a | grep wlxd666
wlxd666 UP 192.168.200.21/24 192.168.200.175/24
pi11@sml:~$ ip link show
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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:(removed) brd ff:ff:ff:ff:ff:ff
3: wlxd666: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether d8:5d:4c:8e:05:2d brd ff:ff:ff:ff:ff:ff