335x中wifi作为热点后

335x中wifi作为热点后,其他设备通过该wifi热点,可以访问外部网络的方法

1.335x前边已经移植好了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移植到开发板上;
内核中也需要配置iptables的支持
[*] Networking support —>

   Networking options  --->
          [*] Network packet filtering framework (Netfilter)  --->
                 Core Netfilter Configuration  --->(全部选上)
                 IP: Netfilter Configuration  ---> (全部选上)

点赞