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 ---> (全部選上)