我有一台服务器,可以连接到两个无线 SSID 之一。在第一个 SSID 上,我需要一个静态 IP,在第二个 SSID 上,我需要一个 DHCP IP。我知道我可以在同一接口上将静态 IP 和 DHCP 都设置为 true,而且这样可以正常工作,但默认路由最终总是针对静态 IP,因此连接到 DHCP 网络时,出站连接总是会失败。
我这里是不是漏掉了什么?有没有办法在接入点级别配置静态 IP 还是 DHCP IP,以便正确设置默认路由?
以下是我当前的 Netplan wifi 配置:
wifis:
wlan0:
optional: true
dhcp-identifier: mac
dhcp4: yes
addresses: [10.86.180.86/23]
gateway4: 10.86.180.1
access-points:
DHCPNet:
password: "YYYYYYYYYYY"
StaticNet:
password: "XXXXXXXXXXX"
ip 的输出如下:
user@testsystem:~$ ip address show wlan0
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 8c:c6:81:31:74:64 brd ff:ff:ff:ff:ff:ff
altname wlo1
altname wlp0s20f3
inet 10.86.180.86/23 brd 10.86.181.255 scope global wlan0
valid_lft forever preferred_lft forever
inet 10.1.1.106/24 brd 10.1.1.255 scope global dynamic wlan0
valid_lft 7195sec preferred_lft 7195sec
还有 lshw -C 网络:
user@testsystem:~$ sudo lshw -C network
*-network
description: Wireless interface
product: Cannon Point-LP CNVi [Wireless-AC]
vendor: Intel Corporation
physical id: 14.3
bus info: pci@0000:00:14.3
logical name: wlan0
version: 30
serial: 8c:c6:81:31:74:64
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.11.0-38-generic firmware=46.4d093a30.0 9000-pu-b0-jf-b0- ip=10.1.1.106 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:16 memory:dc31c000-dc31ffff
*-network:0 DISABLED
description: Ethernet interface
physical id: 2
bus info: usb@2:4
logical name: wwan0
serial: 0e:fc:a6:f7:e9:32
capabilities: ethernet physical
configuration: broadcast=yes driver=cdc_mbim driverversion=5.11.0-38-generic firmware=CDC MBIM link=no multicast=yes
*-network:1
description: Ethernet interface
physical id: 3
bus info: usb@4:1
logical name: eth0
serial: 8c:ae:4c:e9:61:13
size: 1Gbit/s
capacity: 1Gbit/s
capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=ax88179_178a driverversion=5.11.0-38-generic duplex=full ip=10.1.1.107 link=yes multicast=yes port=MII speed=1Gbit/s