我有一台带 wifi 适配器的电脑(接口wlp3s0
,它可以在接入点模式下工作。
使用network-manager
我已经创建的具有静态地址的 WiFi 接入点:
nmcli c a type wifi ifname wlp3s0 con-name 'hotspot' autoconnect no ssid 'test'
nmcli c m 'hotspot' 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method static ipv4.addresses '192.168.3.1'
nmcli c m 'hotspot' wifi-sec.key-mgmt wpa-psk
nmcli c m 'hotspot' wifi-sec.psk '12345678'
nmcli c m 'hotspot' ipv4.gateway '192.168.3.1'
nmcli c m 'hotspot' ipv4.routes '192.168.3.0/24 192.168.3.1'
nmcli c up 'hotspot'
nmcli c up
它运行良好,直到我使用/手动启用和禁用连接nmcli c down
接入点的连接,我才能连接到它。
当我启用autoconnect
接入点时,我可以连接到它,但没有手动定义的路线192.168.3.0/24 192.168.3.1
,我无法连接到在此计算机上运行的 ssh 服务器或执行与 IP 通信相关的任何操作。
为什么在连接中定义的路由在以下情况下不起作用autoconnect
?
UPD:我的连接设置:
$ nmcli c s hotspot
connection.id: hotspot
connection.uuid: 3ecf0211-bd69-4a31-880c-24793bc1bc83
connection.stable-id: --
connection.interface-name: wlp3s0
connection.type: 802-11-wireless
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.timestamp: 1561903483
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries:
connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: -1 (default)
802-11-wireless.ssid: test
802-11-wireless.mode: ap
802-11-wireless.band: bg
802-11-wireless.channel: 0
802-11-wireless.bssid: --
802-11-wireless.rate: 0
802-11-wireless.tx-power: 0
802-11-wireless.mac-address: --
802-11-wireless.cloned-mac-address: --
802-11-wireless.generate-mac-address-mask:--
802-11-wireless.mac-address-blacklist:
802-11-wireless.mac-address-randomization:default
802-11-wireless.mtu: auto
802-11-wireless.seen-bssids: AC:FD:CE:99:9D:78
802-11-wireless.hidden: no
802-11-wireless.powersave: default (0)
802-11-wireless-security.key-mgmt: wpa-psk
802-11-wireless-security.wep-tx-keyidx: 0
802-11-wireless-security.auth-alg: --
802-11-wireless-security.proto:
802-11-wireless-security.pairwise:
802-11-wireless-security.group:
802-11-wireless-security.leap-username: --
802-11-wireless-security.wep-key0: <hidden>
802-11-wireless-security.wep-key1: <hidden>
802-11-wireless-security.wep-key2: <hidden>
802-11-wireless-security.wep-key3: <hidden>
802-11-wireless-security.wep-key-flags: 0 (none)
802-11-wireless-security.wep-key-type: 0 (unknown)
802-11-wireless-security.psk: <hidden>
802-11-wireless-security.psk-flags: 0 (none)
802-11-wireless-security.leap-password: <hidden>
802-11-wireless-security.leap-password-flags:0 (none)
ipv4.method: manual
ipv4.dns:
ipv4.dns-search:
ipv4.dns-options: (default)
ipv4.dns-priority: 0
ipv4.addresses: 192.168.3.1/32
ipv4.gateway: --
ipv4.routes: { ip = 192.168.3.0/24, nh = 192.168.3.1 }
ipv4.route-metric: -1
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.dad-timeout: -1 (default)
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.dns-options: (default)
ipv6.dns-priority: 0
ipv6.addresses:
ipv6.gateway: --
ipv6.routes:
ipv6.route-metric: -1
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
GENERAL.NAME: hotspot
GENERAL.UUID: 3ecf0211-bd69-4a31-880c-24793bc1bc83
GENERAL.DEVICES: wlp3s0
GENERAL.STATE: activated
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/2
GENERAL.SPEC-OBJECT: /org/freedesktop/NetworkManager/AccessPoint/7
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: 192.168.3.1/32
IP4.GATEWAY: --
IP6.ADDRESS[1]: fe80::227e:56d:e216:26d3/64
IP6.GATEWAY: --