Marcus Nguyen Posted August 19, 2019 Posted August 19, 2019 Hello, I am new on the embedded system. I am using Orange Pi zero and I am having stuff with wlan configuration. I want to run the static ip for wifi on the board and reconnect after every time rebooting How I do that? I use 2 files below Quote etc/network/interfaces --------------------------- auto eth0 allow-hotplug eth0 iface eth0 inet static address 192.168.3.100 netmask 255.255.255.0 gateway 192.168.3.1 dns-nameservers 8.8.8.8 8.8.4.4 auto wlan0 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet static address 192.168.3.111 netmask 255.255.255.0 gateway 192.168.3.1 dns-nameservers 8.8.8.8 8.8.4.4 Quote etc/wpa_supplicant/wpa_supplicant.conf ------------------------------------------------ ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="myssid" scan_ssid=1 psk="mypasswork" } The eth0 works fine with this setup otherwise the wlan not active even though I used ifconfig wlan0 up but I using ifconfig wlan0 down, it got the static ip like the configuration file then I can't turn on or off using ifconfig up/down one more time Anyone help me? Thanks a lot!
guidol Posted August 19, 2019 Posted August 19, 2019 To create wpa_supplicant.conf use the follwing command and replace only MySSID with your Wifi_SSID and MyWiFiPassword with the password of your WiFi-Network: su -c "wpa_passphrase MySSID MyWiFIPassword > /etc/wpa_supplicant/wpa_supplicant.conf" In /etc/network/interfaces I do use the following config for a wlan0 configuration: (here you only have to adjust the IP-address and the gateway-IP) # device wlan0 auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.6.126 netmask 255.255.255.0 gateway 192.168.6.1 dns-nameservers 8.8.8.8 8.8.4.4 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf # Disable power saving on compatible chipsets (prevents SSH/connection dropouts ) wireless-mode Managed wireless-power off This combination does work here since years The context of your wpa_supplicant.conf should be like something like this: network={ ssid="MySSID" #psk="MyWiFIPassword" psk=eb6934445c268ab6ba6138318e69929b8b68bd6421c679410c01f2ad78fafe21 } I you know your WiFi password for sure you can delete the bold line with the leading # I did read in the last years that the uncoded password wouldnt work anymore in some cases.
Cumhur Haldun YARDIMCI Posted June 28, 2020 Posted June 28, 2020 Ok. I wonder that if our SSID contain spaces like "my sweet home", how to code rewrite? Thank you.
Recommended Posts