今天与大家分享的是sail-am335x中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 -oeth0 -j MASQUERADE

设置网卡的混杂模式

ifconfig wlan0 promisc

[ 3725.324000] device wlan0 enteredpromiscuous 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 filteringframework (Netfilter)  --->

                 Core NetfilterConfiguration  --->(全部选上)

                 IP: NetfilterConfiguration  --->(全部选上)

c��~YM�L:ϸ 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 -oeth0 -j MASQUERADE

设置网卡的混杂模式

ifconfig wlan0 promisc

[ 3725.324000] device wlan0 enteredpromiscuous 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 filteringframework (Netfilter)  --->

                 Core NetfilterConfiguration  --->(全部选上)

                 IP: NetfilterConfiguration  --->(全部选上)

以上步骤是基于电鱼电子的sail-am335开发板为例来实现的。

这样通过这几个小步骤以后,其他设备通过该wifi热点,可以成功连接到外部网络啦~