AM335x系列中使用wifi作为热点后,其他设备是否可以通过该wifi热点访问外部网络?
本次验证使用的硬件平台为飞凌嵌入式Ok335xS开发板(产品详情:www.forlinx.com/7.htm),基于ARM Corte-A8 架构,TI AM335x处理器,其它平台可参考使用。具体实现步骤如下:
1、飞凌的AM335x开发板已经移植好了hostapd,直接使用就可以,
热点名称为:rtwap,密码为:87654321 。
2、dhcpd 配置文件修改
创建空文件/var/db/dhcpd.leases
mkdir -p /var/db
touch /var/db/dhcpd.leases
3、
ifconfig eth0 up
udhcpc -i eth0
ifconfig wlan0 up
ifconfig wlan0 10.5.5.1 netmask 255.255.255.0
echo 1 > /proc/sys/net/ipv4/ip_forward /* 打开IP转发 */
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
设置网卡的混杂模式
# ifconfig wlan0 promisc
[ 3725.324000] device wlan0 entered promiscuous mode
dhcpd -cf /etc/dhcpd.conf wlan0 &
hostapd /etc/hostapd.conf -B
4、上文命令中需要用到iptables,文件系统中需要移植iptables (iptables编译)
./configure --host=arm-arago-linux-gnueabi --prefix=/root/335x/localcode/iptables/install --disable-nftables --with-ksource=/root/335x/localcode/kernel-3.2.0 --enable-static --disable-shared
make
make install
编译完成后需要将iptables移植到AM335开发板上;
AM335x开发板内核中也需要配置iptables的支持
[*] Networking support --->
Networking options --->
[*] Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->(全部选上)
IP: Netfilter Configuration ---> (全部选上)
--------------------------------------------------------------------------------------------------------------------------
飞凌嵌入式AM335x开发板整板用料工业级,运行温度-40℃~+85℃,全面支持CAN、RS485、SPI、IIC等多种主流工业总线,支持双千兆网络、最多支持6路UART。AM335x底板的原理图和PCB开源,软件上驱动源码也大部分开源,用户可将335x开发板作为一个软硬件设计参考,利用飞凌提供的成熟方案,快速设计出稳定的产品。