How to set static IP address using connman for wifi network
Asked Answered
C

4

6

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?

Caribou answered 11/8, 2015 at 13:43 Comment(0)
C
6

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
Caribou answered 24/8, 2015 at 16:41 Comment(2)
the answer can also be found here developer.toradex.com/knowledge-base/…Caribou
for some reason, it's not taking the desired ip address. it's auto fetching some random ip . what might cause this ?Donaghue
C
10

Instead of editing settings under /var/lib/connman/wifi_<HASH>_managed_psk/, one should edit the config file /var/lib/connman/service-name.config instead.

e.g.

debian@beaglebone:/var/lib/connman$ sudo cat wifi.config
[service_home]
Type = wifi
Name = yyyyyyyyy
Security = wpa
Passphrase = xxxxxxxxxx
IPv4=192.168.1.4/255.255.255.0/192.168.1.254
IPv6=off
Nameservers=8.8.8.8,8.8.4.4

For details, refer to the man page connman-service.config

Celibacy answered 16/4, 2016 at 7:13 Comment(2)
you got a dead link thereNones
Because the link in the answer is broken: github.com/aldebaran/connman/blob/master/doc/config-format.txt and man.archlinux.org/man/connman-service.config.5Osullivan
C
6

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
Caribou answered 24/8, 2015 at 16:41 Comment(2)
the answer can also be found here developer.toradex.com/knowledge-base/…Caribou
for some reason, it's not taking the desired ip address. it's auto fetching some random ip . what might cause this ?Donaghue
B
-1

Try connmanctl enable wifi then you should be able to configure it

Bytom answered 11/8, 2015 at 13:49 Comment(0)
E
-1

once you install connman then it create configuration directory in /var/lib/connman where devices like wifi ,Ethernet etc. configuration file is created. in those file there is entry like :

[service_wifi_<HASH>_managed_psk]
Type = wifi
Name = <SSID>
Passphrase = <PASSPHRASE>   
IPv4.method=dhcp

open that file and see given name is correct that you are using in command

connmanctl config wifi_"HASH"_managed_psk --ipv4 manual 192.168.10.2 255.255.255.0 192.168.10.1

if other than wifi_"HASH"_managed_psk then use that . or you can see by using command connmanctl services

Electronic answered 11/8, 2015 at 14:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.