终端下无线网络配置

  • 查看设备名

    1
    2
    3
    # iwconfig
    # iw dev
    # ip link
  • 启动接口

    1
    2
    # ifconfig wlan0 up
    # ip link set wlan0 up
  • 关闭接口

    1
    2
    # ifconfig wlan0 down
    # ip link set wlan0 down
  • 扫描热点

    1
    2
    # iwlist wlan0 scan
    # iw dev wlan0 scan
  • 连接到WPA/WPA2加密热点

    1
    2
    # wpa_supplicant -i interface -c <(wpa_passphrase your_SSID your_key) -B
    -B参数使wpa_supplicant背景运行
  • 动态获取IP地址

    1
    # dhclient wlan0
  • 设置静态ip地址

    1
    2
    # ip addr add 192.168.0.2/24 dev wlan0
    # ip route add default via 192.168.0.1
  • 查看接口状态

    1
    2
    3
    # iw dev wlan0 link
    # iwconfig wlan0
    # ifconfig wlan0

References:

[1]: Wireless network configuration

===
[erq]