Search code examples
linuxwifidhcpstatic-ip-addressconnman

How to set static IP address using connman for wifi network


I'm trying to set a static IP(manual, no dhcp) address for wifi network using connmanctl. I'm running angstrom linux.

I get the following:

connmanctl
connmanctl> config wifi_"HASH"_managed_psk --ipv4 manual 192.168.10.2 255.255.255.0 192.168.10.1 Error wifi_"HASH"_managed_psk: Not supported

anyone has an idea how to do it?


Solution

  • I managed to get a static IP address by manually creating a file named "settings" inside the directory:

      /var/lib/connman/wifi_<HASH>_managed_psk/
    

    with the following content:

    [wifi_<HASH>_managed_psk] 
    Name=<SSID>                       ←Name of the network 
    SSID=544f52414445585f4252         ←Name of the network in hexadecimal format    
    Favorite=true
    IPv4.method=manual                ←Method to be used (in this case manual IP)
    IPv4.netmask_prefixlen=24
    IPv4.local_address=192.168.0.133  ←Desired IP address
    IPv4.gateway=192.168.0.1
    Passphrase=<PASS>                 ←Wifi network password
    AutoConnect=true
    

    then activated and connected to the wifi

    connmanctl enable wifi
    connmanctl connect wifi_<HASH>_managed_psk