SSU_DNS及DHCP
配置说明
1. 概述¶
P5 SDK默认设置支持ssw102b sdio wifi,因此系统在启动的demo.sh中自动加载sigma_wifi_init.sh来设置wifi网络。
2. 配置以太网静态IP¶
ifconfig eth0 up; ifconfig eth0 hw ether 00:38:1B:8A:82:DB; ifconfig eth0 192.168.137.88 netmask 255.255.255.0 broadcast 192.168.137.1; route add default 192.168.137.1
3. 配置以太网动态IP¶
ifconfig eth0 up; udhcpc -i eth0 -s /etc/init.d/udhcpc.script
4. 开启DNS¶
DNC依赖dnc库文件 ssw102b对应的libdns放置在customer\lib\libdns目录下,如有缺失,可以在project\release\chip\p5\dispcam\common\glibc\6.4.0\wifi\lib\libdns下复制到对应位置,然后到处路径。 测试时可以将lib放在挂载目录下,如:export LD_LIBARY_PATH=$LD_LIBRARY_PATH:/customer/wifi
5. 添加DNS域名服务器¶
在project\image\etc\init.d\udhcpc.script中找到:
for i in &dns ;do echo "Adding DNS server $i" echo "nameserver $i" >> "$tmpfile" done
修改或者在后面加入:
echo "name server 202.96.134.133" >> "$tmpfile"
6. 测试网络¶
6.1. 首先确保板端网络可以访问外部网络¶
ping -I eth0 www.baidu.com PING www.baidu.com (14.215.177.38):56 data bytes //出现这中情况说明dns已经解析到ip,但网络限制无法访问外部网络。
6.2. 采用无线网络¶
运行:
cd customer/wifi; ./sigma_wifi_init.sh
或者:
/customer/wifi # udhcpc -i wlan0 -s /etc/init.d/uphcpc.script udhcpc (v1.20.2) started Setting IP address 0.0.0.0 on wlan0 [Sstar_log]:br0_netdev_open()-1199: dev_get_by_name(br0) Successfully initialized wpa_supplicant Sending discover... wlan0: SME: Trying to authenticate with fa:ac:65:f7:bf:89 (SSID='sstest' freq=2437 MHz) [Sstar_log]:wlan0:free authen bss ++ [Sstar_log]:authen:(fa:ac:65:f7:bf:89),ssid(sstest) [Sstar_log]:wlan0: authenticated wlan0: Trying to associate with fa:ac:65:f7:bf:89 (SSID='sstest' freq=2437 MHz) [Sstar_log]:wlan0:free authen bss ++ [Sstar_log]:wlan0:free authen bss -- [Sstar_log]:wlan0: associated [Sstar_log]:[fa:ac:65:f7:bf:89]:20M channel [Sstar_log]:ieee80211_recalc_ps:work busy wlan0: Associated with fa:ac:65:f7:bf:89 wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0 wlan0: WPA: Key negotiation completed with fa:ac:65:f7:bf:89 [PTK=CCMP GTK=CCMP] wlan0: CTRL-EVENT-CONNECTED - Connection to fa:ac:65:f7:bf:89 completed [id=0 id_str=] [Sstar_log]:ieee80211_recalc_ps:work busy [Sstar_log]:ieee80211_wk_connecting: time out [Sstar_log]:wsm_set_pm:pmMode:129,fastPsmIdlePeriod:255,apPsmChangePeriod:0,minAutoPsPollPeriod:0 Sending discover... Sending select for 192.168.137.88... Lease of 192.168.137.88 obtained, lease time 604800 Setting IP address 192.168.137.88 on wlan0 [Sstar_log]:Sstar_bss_info_changed 749 ,pmMode = 0 [Sstar_log]:wsm_set_pm:pmMode:0,fastPsmIdlePeriod:255,apPsmChangePeriod:0,minAutoPsPollPeriod:0 [Sstar_log]:Sstar_bss_info_changed 760 : pmMode(0) Deleting routers route: SIOCDELRT: No such process Adding router 192.168.137.1 Recreating /customer/wifi/resolv.conf Adding DNS server 192.168.137.1
6.3. 查看wlan0配置信息¶
ifconfig wlan0 wlan0 Link encap:Ethernet HWaddr 24:14:07:24:AC:73 inet addr:192.168.137.88 Bcast:192.168.137.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:969 errors:0 dropped:376 overruns:0 frame:0 TX packets:143 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:349252 (341.0 KiB) TX bytes:11152 (10.8 KiB)
6.4. 网络验证¶
ping -I wlan0 www.baidu.com PING www.baidu.com (163.177.151.109): 56 data bytes 64 bytes from 163.177.151.109: seq=0 ttl=128 time=54.557 ms 64 bytes from 163.177.151.109: seq=1 ttl=128 time=14.317 ms 64 bytes from 163.177.151.109: seq=2 ttl=128 time=4.245 ms 64 bytes from 163.177.151.109: seq=3 ttl=128 time=4.082 ms