You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu Desktop 17.10使用WiFi适配器无法设置静态IP求助

Hey there! Let's break down the key places to check when your Netplan static IP config isn't sticking—even though your WiFi is working fine. Here's what to investigate step by step:

1. Validate your Netplan YAML syntax and static configuration

First, make sure your /etc/netplan/01-network-manager-all.yaml actually defines a static IP setup (not just DHCP). You need to explicitly disable DHCP and set your static details. A correct snippet should look like this:

network:
  version: 2
  renderer: NetworkManager
  wifis:
    wlan0:  # Replace with your actual WiFi interface name
      dhcp4: no
      addresses: [192.168.1.100/24]  # Your static IP + subnet mask
      gateway4: 192.168.1.1  # Your router's IP
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]  # DNS servers
      access-points:
        "YourWiFiSSID":
          password: "YourWiFiPassword"

Critical note: YAML relies entirely on 2-space indentation (no tabs). A single misplaced space will cause the config to fail silently, so double-check your indentation levels.

2. Confirm NetworkManager isn't overriding Netplan

Since your config uses renderer: NetworkManager, it's possible NetworkManager has a separate profile for your WiFi that's set to DHCP. Here's how to check:

  • Run nmcli con show to list all NetworkManager connections. Look for your WiFi SSID's profile.
  • If the profile shows ipv4.method: auto, that means it's using DHCP. To fix this:
    1. Force Netplan to apply the config: sudo netplan generate && sudo netplan apply
    2. Restart NetworkManager to pick up the changes: sudo systemctl restart NetworkManager
    3. Alternatively, edit the NetworkManager profile directly via GUI or nmcli con edit <profile-name> to set static IP matching your Netplan settings.

3. Double-check your WiFi interface name

It's easy to typo the interface name (like wlan0 vs wlp2s0). Run ip link show to get the exact name of your WiFi interface, then make sure it matches the one in your Netplan YAML. If the interface name is wrong, Netplan will ignore the static config and fall back to DHCP.

4. Look for conflicting config files

Netplan processes all .yaml files in /etc/netplan/—if there's another file (like 00-installer-config.yaml) that sets DHCP for your WiFi interface, it might take precedence. Run ls /etc/netplan/ to list all files and check each one for conflicting settings.

Also, if you have an old /etc/network/interfaces file (from the ifupdown era), it could interfere. Comment out any entries for your WiFi interface or remove the file entirely.

5. Ensure your static IP isn't already in use

If the static IP you're trying to assign is already taken by another device on your network, your system might automatically fall back to DHCP. Test this by pinging the IP from another device (e.g., ping 192.168.1.100). If it responds, pick a different IP in your subnet range.

6. Check system logs for error clues

Logs will often tell you exactly what's going wrong. Run these commands to look for issues:

  • sudo journalctl -u NetworkManager: Check for errors related to IP configuration or profile loading
  • sudo journalctl -u netplan-wpa: Look for Netplan-specific issues with your WiFi setup

内容的提问来源于stack exchange,提问作者Zohar Navneet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:44:01