作为无线路由器,需要提供dhcp的功能和无线ap的能力,我们分别通过isc-dhcp-server和hostapd这两个软件来实现,网卡间转发直接通过iptables定义nat规则来实现。 安装dhcp服务和ap热点服务 apt-get install isc-dhcp-server apt-get install hostapd 修改/etc/network/interfaces 在/etc/dhcp/dhcpd.conf添加 修改/etc/hostapd/hostapd.conf
打开内核的网卡转发能力,将/etc/sysctl.conf的 net.ipv4.ip_forward=1 的注释去掉。 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 将规则添加成为自动启动方式 iptables-save > /root/nat.rule 新建/etc/network/if-pre-up.d/iptables #!/bin/bash /sbin/iptables-restore < /root/nat.rule 或者直接在文件里写入规则语句 如果你的hostapd没有办法正常工作,应该是hostapd不支持你的网卡芯片,下载:https://github.com/cnsworder/RTL8188-hostapd/archive/master.zip 在raspberrypi上直接编译就可以了(编译速度确实很慢的) cd hostapd make;make install 重新修改hostapd的配置文件就可以了。
看到了树梅派的热点 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 将规则添加成为自动启动方式 iptables-save > /root/nat.rule 新建/etc/network/if-pre-up.d/iptables #!/bin/bash /sbin/iptables-restore < /root/nat.rule 或者直接在文件里写入规则语句 如果你的hostapd没有办法正常工作,应该是hostapd不支持你的网卡芯片,下载:https://github.com/cnsworder/RTL8188-hostapd/archive/master.zip 在raspberrypi上直接编译就可以了(编译速度确实很慢的) cd hostapd make;make install 重新修改hostapd的配置文件就可以了。
看到了树梅派的热点 作为无线路由器,需要提供dhcp的功能和无线ap的能力,我们分别通过isc-dhcp-server和hostapd这两个软件来实现,网卡间转发直接通过iptables定义nat规则来实现。 本文来自luyouqiwang.net 安装dhcp服务和ap热点服务 路由器网 apt-get install isc-dhcp-server 路由器网 apt-get install hostapd 路由器网 修改/etc/network/interfaces 路由器网
在/etc/dhcp/dhcpd.conf添加 内容来自luyouqiwang.net 修改/etc/hostapd/hostapd.conf 内容来自luyouqiwang.net
打开内核的网卡转发能力,将/etc/sysctl.conf的 net.ipv4.ip_forward=1 的注释去掉。 本文来自luyouqiwang.net iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 本文来自luyouqiwang.net 将规则添加成为自动启动方式 内容来自luyouqiwang.net iptables-save > /root/nat.rule 本文来自luyouqiwang.net 新建/etc/network/if-pre-up.d/iptables 本文来自luyouqiwang.net #!/bin/bash 本文来自luyouqiwang.net /sbin/iptables-restore < /root/nat.rule 路由器网
或者直接在文件里写入规则语句 内容来自luyouqiwang.net 如果你的hostapd没有办法正常工作,应该是hostapd不支持你的网卡芯片,下载:https://github.com/cnsworder/RTL8188-hostapd/archive/master.zip 路由器网 在raspberrypi上直接编译就可以了(编译速度确实很慢的) 路由器网 cd hostapd 内容来自luyouqiwang.net make;make install 路由器网 重新修改hostapd的配置文件就可以了。 路由器网
看到了树梅派的热点 本文来自luyouqiwang.net
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 本文来自luyouqiwang.net
将规则添加成为自动启动方式 内容来自luyouqiwang.net iptables-save > /root/nat.rule 本文来自luyouqiwang.net 新建/etc/network/if-pre-up.d/iptables 路由器网 #!/bin/bash 路由器网 /sbin/iptables-restore < /root/nat.rule 本文来自luyouqiwang.net 或者直接在文件里写入规则语句 内容来自luyouqiwang.net 如果你的hostapd没有办法正常工作,应该是hostapd不支持你的网卡芯片,下载:https://github.com/cnsworder/RTL8188-hostapd/archive/master.zip 本文来自luyouqiwang.net 在raspberrypi上直接编译就可以了(编译速度确实很慢的) 内容来自luyouqiwang.net cd hostapd 路由器网
make;make install 路由器网
重新修改hostapd的配置文件就可以了。 内容来自luyouqiwang.net
看到了树梅派的热点 路由器网
(责任编辑:jida2010) |