我有一台安装了 macOs Big Sur 的 Macbook Air(M1,2020)。我刚刚清除了设备并重新安装了操作系统。我想做的是更改、删除或添加接口,但我做不到。每次我尝试更改时ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address
都会出现一些问题。
我已经尝试过了
sudo ifconfig [interface] down
sudo route flush
sudo ifconfig [interface] up
沒有改變任何内容。
这是我的ifconfig
输出:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
anpi0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:29:40:24:74:78
inet6 fe80::1c29:40ff:fe24:7478%anpi0 prefixlen 64 scopeid 0x4
nd6 options=201<PERFORMNUD,DAD>
media: none
status: inactive
anpi1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:29:40:24:74:79
inet6 fe80::1c29:40ff:fe24:7479%anpi1 prefixlen 64 scopeid 0x5
nd6 options=201<PERFORMNUD,DAD>
media: none
status: inactive
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 3a:3e:ef:dd:ff:1c
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: inactive
en3: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:29:40:24:74:58
nd6 options=201<PERFORMNUD,DAD>
media: none
status: inactive
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:29:40:24:74:59
nd6 options=201<PERFORMNUD,DAD>
media: none
status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 18:3e:ef:dd:ff:1c
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (<unknown type>)
status: inactive
en1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 36:70:27:78:e3:80
media: autoselect <full-duplex>
status: inactive
en2: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 36:70:27:78:e3:84
media: autoselect <full-duplex>
status: inactive
awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:b0:66:eb:50:ac
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: inactive
llw0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 1e:b0:66:eb:50:ac
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: inactive
utun2: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mtu 1380
inet6 fe80::c171:924:274f:c2a1%utun2 prefixlen 64 scopeid 0x13
nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::6422:e4c5:67c3:5e9c%utun3 prefixlen 64 scopeid 0x14
nd6 options=201<PERFORMNUD,DAD>
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6467<RXCSUM,TXCSUM,VLAN_MTU,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether 00:e0:4c:68:04:bb
inet6 fe80::1cb8:705d:659f:c6d7%en4 prefixlen 64 secured scopeid 0x8
inet6 2a02:2454:5b0:7c00:c06:118c:8e39:515d prefixlen 64 autoconf secured
inet6 2a02:2454:5b0:7c00:14a3:cad1:473a:7f25 prefixlen 64 autoconf temporary
inet 192.168.0.5 netmask 0xffffff00 broadcast 192.168.0.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (1000baseT <full-duplex>)
status: active
这是我的路由表(记住,在我重新安装操作系统之后!):
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 192.168.0.1 UGScg en4
127 localhost UCS lo0
localhost localhost UH lo0
169.254 link#8 UCS en4 !
192.168.0 link#8 UCS en4 !
192.168.0.1/32 link#8 UCS en4 !
192.168.0.1 dc:53:7c:77:30:b8 UHLWIir en4 1134
192.168.0.5/32 link#8 UCS en4 !
224.0.0/4 link#8 UmCS en4 !
224.0.0.251 1:0:5e:0:0:fb UHmLWI en4
255.255.255.255/32 link#8 UCS en4 !
Internet6:
Destination Gateway Flags Netif Expire
default fe80::de53:7cff:fe UGcg en4
localhost localhost UHL lo0
2a02-2454-5b0-7c00 link#8 UC en4
2a02-2454-5b0-7c00 fe80::de53:7cff:fe UGc en4
2a02-2454-5b0-7c00 0:e0:4c:68:4:bb UHL lo0
2a02-2454-5b0-7c00 0:e0:4c:68:4:bb UHL lo0
2a02-2454-5b0-7c00 link#8 UHLWI en4
fe80::%lo0 fe80::1%lo0 UcI lo0
fe80::1%lo0 link#1 UHLI lo0
fe80::%anpi0 link#4 UCI anpi0
fe80::1c29:40ff:fe 1e:29:40:24:74:78 UHLI lo0
fe80::%anpi1 link#5 UCI anpi1
fe80::1c29:40ff:fe 1e:29:40:24:74:79 UHLI lo0
fe80::%en4 link#8 UCI en4
fe80::1cb8:705d:65 0:e0:4c:68:4:bb UHLI lo0
fe80::de53:7cff:fe dc:53:7c:77:30:b8 UHLWIir en4
fe80::%utun2 fe80::c171:924:274 UcI utun2
fe80::c171:924:274 link#19 UHLI lo0
fe80::%utun3 fe80::6422:e4c5:67 UcI utun3
fe80::6422:e4c5:67 link#20 UHLI lo0
ff00:: localhost UmCI lo0
ff00:: link#4 UmCI anpi0
ff00:: link#5 UmCI anpi1
ff00:: link#8 UmCI en4
ff00:: link#14 UmCI awdl0
ff00:: link#15 UmCI llw0
ff00:: fe80::c171:924:274 UmCI utun2
ff00:: fe80::6422:e4c5:67 UmCI utun3
ff01::%lo0 localhost UmCI lo0
ff01::%anpi0 link#4 UmCI anpi0
ff01::%anpi1 link#5 UmCI anpi1
ff01::%en4 link#8 UmCI en4
ff01::%awdl0 link#14 UmCI awdl0
ff01::%llw0 link#15 UmCI llw0
ff01::%utun2 fe80::c171:924:274 UmCI utun2
ff01::%utun3 fe80::6422:e4c5:67 UmCI utun3
ff02::%lo0 localhost UmCI lo0
ff02::%anpi0 link#4 UmCI anpi0
ff02::%anpi1 link#5 UmCI anpi1
ff02::%en4 link#8 UmCI en4
ff02::%awdl0 link#14 UmCI awdl0
ff02::%llw0 link#15 UmCI llw0
ff02::%utun2 fe80::c171:924:274 UmCI utun2
ff02::%utun3 fe80::6422:e4c5:67 UmCI utun3
有什么建议我可以尝试避免这个错误或我的网络发生了什么?
答案1
目前尚不清楚您发出了哪些命令导致了错误。
就我而言,我在尝试使用 更改 macOS 14.3.1 (Sonoma) 上的 Wi-Fi MAC 地址时看到了此错误。如果 Wi-Fi 接口已关闭或已连接到网络,sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx
则会导致此错误。ioctl (SIOCAIFADDR): Can't assign requested address
解决方案是保持 Wi-Fi 开启,但断开与任何网络的连接。断开接口后,ifconfig
成功运行,我能够更改 MAC 地址。此时,我能够重新连接到所需的网络。