Hi Team,
My board is an i.MX8MP, I am trying to configure static IP addresses for wifi(wlan0) interface, but I am encountering an error in the .yaml file. I would appreciate your assistance in this issue.
Thanks,
Sureshkumar R
Hello @krsuresh ,
I hope you are doing well.
I have shared the steps to provide a static IP to wifi interface, Please run them.
1) load the drivers.
2) ifconfig -a (Make sure the interface wlan0 is seen)
3) ifconfig wlan0 up
4) Based on the class and subnet mask, the usable host IP range for the network makes configuration changes
5) Go to the netplan directory located at /etc/netplan.
6) I have shared an example below based on that make changes.
network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
dhcp4: no
addresses: [172.23.207.254/20]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.8.4]
now apply those changes by giving the below command
sudo netplan try
I hope it helps!
Thanks & Regards,
Sanket Parekh
Hi Sanket,
Thanks for the reply. I hope all is well with you.
root@imx8mpsolidrun:~# cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: NetworkManager
wifis:
wlan0:
addresses: [182.168.4.10/16]
access-points:
Mywifi1:
password: G4XJdbuBVsQeq6Rz
dhcp4: true
With this configurations, I am now experiencing a different error,
root@imx8mpsolidrun:~# netplan --debug apply
** (generate:899): DEBUG: 20:06:43.238: starting new processing pass
** (generate:899): DEBUG: 20:06:43.243: wlan0: adding wifi AP 'Mywifi1'
** (generate:899): DEBUG: 20:06:43.244: We have some netdefs, pass them through a final round of validation
** (generate:899): DEBUG: 20:06:43.244: wlan0: setting default backend to 2
** (generate:899): DEBUG: 20:06:43.244: Configuration is valid
** (generate:899): DEBUG: 20:06:43.244: Generating output files..
** (generate:899): DEBUG: 20:06:43.244: networkd: definition wlan0 is not for us (backend 2)
** (generate:899): DEBUG: 20:06:43.244: openvswitch: definition wlan0 is not for us (backend 2)
DEBUG:no netplan generated networkd configuration exists
DEBUG:netplan generated NM configuration changed, restarting NM
DEBUG:wlan0 not found in {}
DEBUG:Merged config:
network:
renderer: NetworkManager
version: 2
wifis:
wlan0:
access-points:
Mywifi1:
password: G4XJdbuBVsQeq6Rz
addresses:
- 182.168.4.10/16
dhcp4: true
DEBUG:Link changes: {}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for eth0
DEBUG:netplan triggering .link rules for wlan0
DEBUG:netplan triggering .link rules for eth1
** (process:896): DEBUG: 20:06:44.070: starting new processing pass
** (process:896): DEBUG: 20:06:44.075: wlan0: adding wifi AP 'Mywifi1'
** (process:896): DEBUG: 20:06:44.076: We have some netdefs, pass them through a final round of validation
** (process:896): DEBUG: 20:06:44.076: wlan0: setting default backend to 2
** (process:896): DEBUG: 20:06:44.076: Configuration is valid
DEBUG:wlan0 not found in {}
DEBUG:Merged config:
network:
renderer: NetworkManager
version: 2
wifis:
wlan0:
access-points:
Mywifi1:
password: G4XJdbuBVsQeq6Rz
addresses:
- 182.168.4.10/16
dhcp4: true
Thanks,
Sureshkumar R
Hello @krsuresh ,
->Did you run the below command to assign static IP to the wlan0 interface?
ifconfig -a
ifconfig wlan0 up
ifconfig wlan0 <static_ip> netmask <mask_id> up
ifconfig wlan0
Please share the observation.
Thanks & Regards,
Sanket Parekh
Yes, I am able to assign static IP as manual. Please find the observation,
root@imx8mpsolidrun:~# ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 3a:be:83:ac:c9:e7 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@imx8mpsolidrun:~# ifconfig wlan0 192.168.5.1 netmask 255.255.255.0 up
root@imx8mpsolidrun:~# ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.5.1 netmask 255.255.255.0 broadcast 192.168.5.255
ether 3a:be:83:ac:c9:e7 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Thanks,
Sureshkumar R
Hello @krsuresh ,
I hope you are doing well.
I'm glad the issue is solved.
Hence Can I close this thread?
Thanks & Regards,
Sanket Parekh
Hi @Sanket_Parekh,
Thanks for the reply.
Yes, I am able to configure using ifconfig. But my goal is to configure a static IP address for the board when it is brought up.
Thanks,
SureshKumar R
Hello @krsuresh ,
I hope you are doing well.
->OK, If one is using Android BSP then one has to write the same ifconfig commands in init.rc file.
->save that file and restart the board.
It will help
Thanks & Regards,
Sanket Parekh