Samsung ARTIK Wi-Fi Client Configuration

来源:互联网 发布:激战2男性捏脸数据 编辑:程序博客网 时间:2024/05/07 21:37

  • 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,
ARTIK 530 attached the Antenna

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 24 (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_interface=/var/run/wpa_supplicantctrl_interface_group=wheelupdate_config=1network={    ssid="SA-WPGHOLDINGS"    psk=XXXXce5c1e200e6b3cbcdc2328c04b355fd9751d55e22aa0e84ad015b81aXXXX}[root@artik connman]# 

wpa_supplicant already configured start automatically,

[root@artik 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 2017-06-13 00:47:55 EDT; 2h 0min ago Main PID: 2045 (wpa_supplicant)   CGroup: /system.slice/wpa_supplicant.service           └─2045 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -Jun 13 00:47:55 artik systemd[1]: Started WPA supplicant.Jun 13 00:47:55 artik wpa_supplicant[2045]: Successfully initialized wpa_supplicantJun 13 00:47:55 artik wpa_supplicant[2045]: WPS: Converting push_button to virtual_push_buJun 13 00:47:55 artik wpa_supplicant[2045]: WPS: Converting push_button to virtual_push_buJun 13 00:47:55 artik wpa_supplicant[2045]: WPS: Converting push_button to virtual_push_buJun 13 00:47:58 artik wpa_supplicant[2045]: wlan0: Trying to associate with c0:56:27:a8:fdJun 13 00:47:58 artik wpa_supplicant[2045]: wlan0: Associated with c0:56:27:a8:fd:d6Jun 13 00:47:58 artik wpa_supplicant[2045]: wlan0: WPA: Key negotiation completed with c0:Jun 13 00:47:58 artik wpa_supplicant[2045]: wlan0: CTRL-EVENT-CONNECTED - Connection to c0Jun 13 00:47:58 artik wpa_supplicant[2045]: p2p0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IElines 1-17/17 (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 10start(){    i=1    while ! ifconfig wlan0 2>>/tmp/wlan_err.log >>/tmp/wlan.log    do        echo "-------- run $i --------" >>/tmp/wlan.log        ifconfig wlan0 2>>/tmp/wlan_err.log >>/tmp/wlan.log        sleep 1        i=$((i + 1))    done#    echo "-------- starting wpa_supplicant --------" >>/tmp/wlan.log#    /usr/sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf >>/tmp/wlan.log &    i=1    while ! wpa_cli status wlan0 | grep -iq "wpa_state=completed"    do        echo "-------- run $i --------" >>/tmp/wlan.log        sleep 1        i=$((i + 1))    done    echo "-------- starting dhcpclient --------" >>/tmp/wlan.log    /usr/sbin/dhclient wlan0 >>/tmp/wlan.log}stop(){kill dhclient}restart(){stopstart}case "$1" in  start)    start    ;;  stop)    stop    ;;  restart)    restart    ;;  *)    echo "Usage:$0 {start|stop|restart}"esacexit 0

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

#! /bin/bashif ! ifconfig wlan0 >> nullthenecho "does not exist wlan0"fiif ! ifconfig wlan1 >> nullthenecho "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.

[root@artik ~]# cat /tmp/wlan_err.log wlan0: error fetching interface information: Device not foundwlan0: error fetching interface information: Device not foundwlan0: error fetching interface information: Device not foundwlan0: error fetching interface information: Device not foundwlan0: error fetching interface information: Device not foundwlan0: error fetching interface information: Device not found[root@artik ~]# cat /tmp/wlan.log -------- run 1 ---------------- run 2 ---------------- run 3 --------wlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500        ether 70:2c:1f:24:92:40  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-------- run 1 ---------------- run 2 ---------------- run 3 ---------------- run 4 ---------------- starting dhcpclient --------

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

[root@artik ~]# ifconfigeth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500        inet 10.65.103.38  netmask 255.255.255.0  broadcast 10.65.103.255        inet6 fe80::742a:faff:fe0e:5a07  prefixlen 64  scopeid 0x20<link>        ether 76:2a:fa:0e:5a:07  txqueuelen 1000  (Ethernet)        RX packets 85290  bytes 7447811 (7.1 MiB)        RX errors 0  dropped 412  overruns 0  frame 0        TX packets 124  bytes 13321 (13.0 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0        device interrupt 64  lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10<host>        loop  txqueuelen 1  (Local Loopback)        RX packets 179  bytes 14535 (14.1 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 179  bytes 14535 (14.1 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0p2p0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500        ether 72:2c:1f:24:92:40  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 0wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 10.65.109.168  netmask 255.255.255.0  broadcast 10.65.109.255        inet6 fe80::722c:1fff:fe24:9240  prefixlen 64  scopeid 0x20<link>        ether 70:2c:1f:24:92:40  txqueuelen 1000  (Ethernet)        RX packets 101955  bytes 30356888 (28.9 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 8891  bytes 619061 (604.5 KiB)        TX errors 0  dropped 199 overruns 0  carrier 0  collisions 0[root@artik connman]# cat /etc/resolv.conf ; generated by /usr/sbin/dhclient-scriptsearch wpgholdings.comnameserver 10.65.11.81nameserver 10.65.11.82[root@artik connman]# [root@artik ~]# ping 8.8.8.8PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.64 bytes from 8.8.8.8: icmp_seq=1 ttl=53 time=495 ms64 bytes from 8.8.8.8: icmp_seq=2 ttl=53 time=5.27 ms64 bytes from 8.8.8.8: icmp_seq=3 ttl=53 time=11.8 ms--- 8.8.8.8 ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2002msrtt min/avg/max/mdev = 5.277/170.722/495.066/229.361 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


原创粉丝点击