天天看点

Samsung ARTIK Wi-Fi Client ConfigurationSummaryWi-Fi Client ConfigurationReboot WIFI cannot connect automatically issueReference

  • Summary
  • Wi-Fi Client Configuration
  • Reboot WIFI cannot connect automatically issue
  • Reference

Summary

Setup Samsung ARTIK Wi-Fi Client, and configured auto connect to Wi-Fi after reboot, with successful result.

ARTIK 530 attached the Antenna,

Samsung ARTIK Wi-Fi Client ConfigurationSummaryWi-Fi Client ConfigurationReboot WIFI cannot connect automatically issueReference

Wi-Fi Client Configuration

Follow this Link to configure the Wi-Fi Client, the ifcfg-eth0 configuration is setup already as below,

[root@artik ~]# cat /etc/redhat-release 
Fedora release  (Twenty Four)
[root@artik ~]# 
[root@artik ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
PERSISTENT_DHCLIENT="yes"
[root@artik ~]# 
           

Setting as below,

[root@artik connman]# cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interhljs-reserved">var/run/wpa_supplicant
ctrl_interface_group=wheel

update_config=
network={
    ssid="SA-WPGHOLDINGS"
    psk=XXXXce5c1e200e6b3cbcdc2328c04b355fd9751d55e22aa0e84ad015b81aXXXX
}
[root@artik connman]# 
           

wpa_supplicant already configured start automatically,

[[email protected] connman]# systemctl status wpa_supplicant
● wpa_supplicant.service - WPA supplicant
   Loaded: loaded (/usr/lib/systemd/system/wpa_supplicant.service; disabled; vendor preset
   Active: active (running) since Tue -- :: EDT; h min ago
 Main PID:  (wpa_supplicant)
   CGroup: /system.slice/wpa_supplicant.service
           └─ /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -

Jun  :: artik systemd[]: Started WPA supplicant.
Jun  :: artik wpa_supplicant[]: Successfully initialized wpa_supplicant
Jun  :: artik wpa_supplicant[]: WPS: Converting push_button to virtual_push_bu
Jun  :: artik wpa_supplicant[]: WPS: Converting push_button to virtual_push_bu
Jun  :: artik wpa_supplicant[]: WPS: Converting push_button to virtual_push_bu
Jun  :: artik wpa_supplicant[]: wlan0: Trying to associate with c0:::a8:fd
Jun  :: artik wpa_supplicant[]: wlan0: Associated with c0:::a8:fd:d6
Jun  :: artik wpa_supplicant[]: wlan0: WPA: Key negotiation completed with c0:
Jun  :: artik wpa_supplicant[]: wlan0: CTRL-EVENT-CONNECTED - Connection to c0
Jun  :: artik wpa_supplicant[]: p2p0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE
lines -/ (END)
           

Reboot WIFI cannot connect automatically issue

You can configure your system to automatically reconnect Wi-Fi after each reboot. However the system init script provided on the website cannot work properly, the Wi-Fi cannot connect after reboot, refer to this Link to solve this problem.

The root cause is when executing the command

dhclient wlan0

, the wlan0 interface is not up, caused command execution fail, so need to wait until wlan0 is up, below updated init script can work properly.

The updated init script is as below,

#! /bin/bash
# chkconfig: - 99 10

start()
{
    i=
    while ! ifconfig wlan0 >>/tmp/wlan_err.log >>/tmp/wlan.log
    do
        echo "-------- run $i --------" >>/tmp/wlan.log
        ifconfig wlan0 >>/tmp/wlan_err.log >>/tmp/wlan.log
        sleep 
        i=$((i + ))
    done

#    echo "-------- starting wpa_supplicant --------" >>/tmp/wlan.log
#    /usr/sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf >>/tmp/wlan.log &

    i=
    while ! wpa_cli status wlan0 | grep -iq "wpa_state=completed"
    do
        echo "-------- run $i --------" >>/tmp/wlan.log
        sleep 
        i=$((i + ))
    done

    echo "-------- starting dhcpclient --------" >>/tmp/wlan.log
    /usr/sbin/dhclient wlan0 >>/tmp/wlan.log
}

stop()
{
kill dhclient
}

restart()
{
stop
start
}


case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  *)
    echo "Usage:$0 {start|stop|restart}"
esac

exit 
           

Below shell script experiment the command return (0 or 1).

#! /bin/bash
if ! ifconfig wlan0 >> null
then
echo "does not exist wlan0"
fi
if ! ifconfig wlan1 >> null
then
echo "doesn't exist wlan1"
fi
           

Below is the startup log when executing the init script, you can see until wlan0 is up and can

grep

the characters

"wpa_state=completed"

, then execute command

dhclient wlan0

.

[[email protected] ~]# cat /tmp/wlan_err.log 
wlan0: error fetching interface information: Device not found
wlan0: error fetching interface information: Device not found
wlan0: error fetching interface information: Device not found
wlan0: error fetching interface information: Device not found
wlan0: error fetching interface information: Device not found
wlan0: error fetching interface information: Device not found
[[email protected] ~]# cat /tmp/wlan.log 
-------- run 1 --------
-------- run 2 --------
-------- run 3 --------
wlan0: flags=<BROADCAST,MULTICAST>  mtu 
        ether :c:f:::  txqueuelen   (Ethernet)
        RX packets   bytes  ( B)
        RX errors   dropped   overruns   frame 
        TX packets   bytes  ( B)
        TX errors   dropped  overruns   carrier   collisions 

-------- run 1 --------
-------- run 2 --------
-------- run 3 --------
-------- run 4 --------
-------- starting dhcpclient --------
           

The Ethernet and Wi-Fi connect result is as below,

[root@artik ~]# ifconfig
eth: flags=-<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 
        inet .  netmask .  broadcast .
        inet6 fe8::a:faff:fe0e:a07  prefixlen   scopeid <link>
        ether :a:fa:0e:a:  txqueuelen   (Ethernet)
        RX packets   bytes  ( MiB)
        RX errors   dropped   overruns   frame 
        TX packets   bytes  ( KiB)
        TX errors   dropped  overruns   carrier   collisions 
        device interrupt   

lo: flags=<UP,LOOPBACK,RUNNING>  mtu 
        inet ..  netmask ..
        inet6 ::  prefixlen   scopeid <host>
        loop  txqueuelen   (Local Loopback)
        RX packets   bytes  ( KiB)
        RX errors   dropped   overruns   frame 
        TX packets   bytes  ( KiB)
        TX errors   dropped  overruns   carrier   collisions 

p2p: flags=-<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 
        ether :c:f:::  txqueuelen   (Ethernet)
        RX packets   bytes  (. B)
        RX errors   dropped   overruns   frame 
        TX packets   bytes  (. B)
        TX errors   dropped  overruns   carrier   collisions 

wlan: flags=<UP,BROADCAST,RUNNING,MULTICAST>  mtu 
        inet .  netmask .  broadcast .
        inet6 fe8::c:fff:fe24:  prefixlen   scopeid <link>
        ether :c:f:::  txqueuelen   (Ethernet)
        RX packets   bytes  ( MiB)
        RX errors   dropped   overruns   frame 
        TX packets   bytes  ( KiB)
        TX errors   dropped  overruns   carrier   collisions 

[root@artik connman]# cat /etc/resolv.conf 
; generated by /usr/sbin/dhclient-script
search wpgholdings.com
nameserver .
nameserver .
[root@artik connman]# 



[root@artik ~]# ping 8.8.8.8
PING . (.) () bytes of data.
 bytes from .: icmp_seq= ttl= time= ms
 bytes from .: icmp_seq= ttl= time= ms
 bytes from .: icmp_seq= ttl= time= ms

--- . ping statistics ---
 packets transmitted,  received, % packet loss, time ms
rtt min/avg/max/mdev = /// ms
[root@artik ~]# 
           

Reference

Samsung ARTIK Configuring Ethernet

Where do the antennas go?

Ethernet and Wi-Fi Networks

ARTIK Wi-Fi Client Configuration

Wifi didn’t setup automatically

继续阅读