raspberry wifi(raspberry pi 4b openwrt)

本文为大家介绍raspberry wifi(raspberry pi 4b openwrt),下面和小编一起看看详细内容吧。
树莓派无线路由器篇
raspberrypi的折腾方式有很多种,我把我的折腾经验分享给大家。
作为无线路由器,需要提供dhcp的功能和无线ap的能力。我们分别使用软件isc-dhcp-server和hostapd来实现。网卡之间的转发直接通过在iptables中定义nat规则来实现。
安装dhcp服务和ap热点服务
[python]
apt-get 安装isc-dhcp-server
apt 安装hostapd
修改/etc/network/interfaces
在/etc/dhcp/dhcpd.conf中添加
修改/etc/hostapd/hostapd.conf
开启内核网卡的转发能力,设置/etc/sysctl.conf
[python]
net.ipv4.ip_forward=1
评论已删除。
修改iptables的nat规则
[python]
iptables -t nat -a postrouting -o eth0 -j masquerade
添加规则作为自动启动方法
[python]
iptables-save /root/nat.rule
新建/etc/network/if-pre-up.d/iptables
[python]
#!/bin/庆典
/sbin/iptables-恢复
好了,raspberry wifi(raspberry pi 4b openwrt)的介绍到这里就结束了,想知道更多相关资料可以收藏我们的网站。