手把手教你使用 Raspberry - Wireless-Access-Point
RPI Wireless-Access-Point
将Raspberry Pi3 作为无线路由接入点
Install the necessary software.
$ sudo apt-get install hostapd udhcpd
Configure DHCP
/etc/udhcpd.conf
$ sudo nano /etc/udhcpd.conf// 将文件修为为如下内容:start 192.168.42.2 # This is the range of IPs that the hostspot will give to client devices. end 192.168.42.20 interface wlan0 # The device uDHCP listens on. remaining yes opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use. opt subnet 255.255.255.0 opt router 192.168.42.1 # The Pi's IP address on wlan0 which we will set up shortly. opt lease 864000 # 10 day DHCP lease time in seconds
Edit the file
/etc/default/udhcpd
and change the line:DHCPD_ENABLED="no"
to
#DHCPD_ENABLED="no"
Configure Network
allow-hotplug wlan0 iface wlan0 inet static address 192.168.42.1 netmask 255.255.255.0
Change the lines (they probably won’t all be next to each other):
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet manual
to
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf#iface default inet dhcp
/etc/network/interfaces
like this:# interfaces(5) file used by ifup(8) and ifdown(8)# Please note that this file is written to be used with dhcpcd# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'# Include files from /etc/network/interfaces.d:source-directory /etc/network/interfaces.dauto lo iface lo inet loopbackiface eth0 inet manualallow-hotplug wlan0 iface wlan0 inet staticaddress 192.168.52.1netmask 255.255.255.0gateway 192.168.52.1network 192.168.52.0broadcast 192.168.52.255dns-nameservers 192.168.52.1 8.8.8.8 8.8.4.4#iface wlan0 inet manual# wpa-conf /etc/wpa_supplicantwpa_supplicant.conf#allow-hotplug wlan1#iface wlan1 inet manual# wpa-conf /etc/wpa_supplicant/wpa_supplicant.confup iptables-restore < /etc/iptables.ipv4.nat
Configure HostAPD. edit the file
/etc/hostapd/hostapd.conf
(create it if it doesn’t exist) and add the following lines:A secure network
interface=wlan0 driver=nl80211 ssid=My_AP hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=My_Password wpa_key_mgmt=WPA-PSK#wpa_pairwise=TKIP # You better do not use this weak encryption (only used by old client devices)rsn_pairwise=CCMP
A open network
interface=wlan0 ssid=My_AP hw_mode=g channel=6 auth_algs=1 wmm_enabled=0
If Raspberry Pi 3 add this parameters:
ieee80211n=1 # 802.11n support wmm_enabled=1 # QoS support ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
Edit the file
/etc/default/hostapd
and change the line:#DAEMON_CONF=""
to
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Configure NAT (Network Address Translation). NAT is a technique that allows several devices to use a single connection to the internet. Linux supports NAT using Netfilter (also known as iptables) and is fairly easy to set up. First, enable IP forwarding in the kernel:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
To set this up automatically on boot, edit the file /etc/sysctl.conf and add the following line to the bottom of the file:
net.ipv4.ip_forward=1
To enable NAT in the kernel, run the following commands:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
These instructions don’t give a good solution for rerouting https and for URLs referring to a page inside a domain, like www.nu.nl/38274.htm. The user will see a 404 error. Your Pi is now NAT-ing. To make this permanent so you don’t have to run the commands after each reboot, run the following command:
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Now edit the file /etc/network/interfaces and add the following line to the bottom of the file:
up iptables-restore < /etc/iptables.ipv4.nat
Fire it Up!
sudo service hostapd start sudo service udhcpd start
Your Pi should now be hosting a wireless hotspot. To get the hotspot to start on boot, run these additional commands:
sudo update-rc.d hostapd enable sudo update-rc.d udhcpd enable
本文参考RPI-Wireless-Hotspot,在其基础之上网络配置部分稍作调整,在Raspberry Debian 8 上运行没有问题!
手把手教你使用 Raspberry - Wireless-Access-Point相关推荐
- 手把手教你如何建立自己的Linux系统(LFS速成手册)
原贴:http://www.linuxsir.org/bbs/showthread.php?t=244052 LinuxSir.Org > Linux 发行版讨论区 -- LinuxSir.Or ...
- 手把手教你使用VS制作winform安装包
手把手教你使用VS制作winform安装包 使用VS 自带的打包工具,制作winform安装项目 开发环境:VS 2008 Access 操作系统:Windows XP 开发语言:C# 项目名称:** ...
- 手把手教你学习网络编程(1)
手把手教你学习网络编程(1) 目录: 1) 什么是套接字? 2) Internet 套接字的两种类型 3) 网络理论 4) 结构体 5) 本机转换 6) IP 地址和如何处理它们 7) socket( ...
- 手把手教你搭建惊艳的博客
系列文章目录 第一章 手把手教你搭建自己的博客 文章目录 系列文章目录 前言 一.网站软件的选择 二.网站空间的选择 1. 建议选择有名.大厂的 2. 上手容易,丰富而详实的文档 3. 要稳定,少出问 ...
- 手把手教你用Python轻松玩转SQL注入
点击上方"Python爬虫与数据挖掘",进行关注 回复"书籍"即可获赠Python从入门到进阶共10本电子书 今 日 鸡 汤 山有木兮木有枝,心悦君兮君不知. ...
- 手把手教你构建 C 语言编译器(8)- 表达式
这是整个编译器的最后一部分,解析表达式.什么是表达式?表达式是将各种语言要素的一个组合,用来求值.例如:函数调用.变量赋值.运算符运算等等. 表达式的解析难点有二:一是运算符的优先级问题,二是如何将表 ...
- Nginx系列教程(六)| 手把手教你搭建 LNMP 架构并部署天空网络电影系统
作者:JackTian 微信公众号:杰哥的IT之旅(ID:Jake_Internet) LAMP 系列导读 01. LAMP 系列教程(一)| 详解 Linux 环境下部署 HTTPD 服务 02. ...
- 【玩转华为云】手把手教你利用ModelArts识别偶像的声音
本篇推文共计2000个字,阅读时间约3分钟. 华为云-华为公司倾力打造的云战略品牌,2011年成立,致力于为全球客户提供领先的公有云服务,包含弹性云服务器.云数据库.云安全等云计算服务,软件开发服务, ...
- 搜狐邮件服务器地址加密方式,手把手教你如何用SMIME加密任意邮件
原标题:手把手教你如何用SMIME加密任意邮件 在此之前,我曾写过一篇关于邮件服务提供商安全问题的文章[传送门],你可以根据我的建议来选择一个比较合适的邮件提供商.但是,如果你已经有自己的邮箱并且使用 ...
最新文章
- Learn Jenkins the hard way (0) - Jenkins的罪与罚
- UltraEdit 21激活
- ISE include 头文件错误的解决办法
- benchmark mysql_程序员的MySQL手册(二): 监控与benchmark
- 凸优化中如何改进GD方法以防止陷入局部最优解
- 光环大数据spark文档_推荐大数据Spark必读书目
- Redis启动报错:[20000] 07 Apr 17:55:34.562 # Creating Server TCP listening socket 127.0.0.1:6379: bind: N
- Golang 在十二赞的深度应用
- loj 6085.「美团 CodeM 资格赛」优惠券
- Cesium笔记(3):基本控件简介—ImageryProvider地图瓦片地图配
- 强烈推荐!!!Ubuntu19.04安装向日葵踩到的坑【尤其是ubuntu 19.04 遇到了libpng12.so.0 导致无法apt 更新!!!!】
- 2021.9.9 prescan文档翻译 Adaptive Cruise Control System
- QC七大手法(New)
- QTextStream 类(文本流)和 QDataStream 类(数据流)
- matlab 神经网络train均方误差,MATLAB搭建bp神经网络的误差特别大,但R2的值也大,求解帮我看看我的网络哪里出问题了...
- SpringSecurity(安全)
- 基于微信小程序的新生自助报到系统小程序
- Design a Facebook NewsFeed
- 当前NBIoT设备的省电技术之PSM/DRX/eDRX
- 《赵成的运维体系管理课》学习笔记(4)——稳定性保障
热门文章
- “杀人”套路贷:借1万,3个月后要还60万
- java开发环境(sts,eclipse等等)解决项目上的红叉和红色感叹号的方法。
- Maven、gradle、Ant、Eclipse IDE之间的关系
- CAS单点登录(一):启动CAS认证中心服务
- MongoDB快速实战与基本原理-01
- 旋转导电滑环的作用和优缺点
- 使用winhex查看FAT16格式结构
- 二进制安装K8S(四):部署flannel网络
- Ubuntu20.04+RTX3090+CUDA11.4+CUDNN8.5.0安装与卸载
- AGA8_92DC压缩因子计算 C源码