当前位置: 首页 > news >正文

编译树莓派2代B型OpenWrt固件实现无线路由器及nodogsplash认证功能

最终功能:

无线路由器的主要功能,网口WAN接入,USB无线网卡AP热点输出,连上wifi之后跳转到认证页面,点击认证方可上网,有效时间10分钟,认证成功之后自动访问指定网址。

文章结尾有编译好的刷机包下载

硬件准备:

1.Raspberry Pi 2 model B

2.USB无线网卡,我使用的是TL-WN722N 150Mbps 芯片是AR9271

3.操作系统:CentOS 7

4.SD卡8GB

开始之前最好配置好代理,因为编译过程中所有的依赖会联网自动下载,会有大部分时间耗在这里,如果速度慢或者被墙……

配置编译环境(一定要非root账户):

#升级组件
sudo yum update
#安装编译组件
sudo yum install libtool autoconf automake gcc-multilib bison screen gcc g++ binutils patch bzip2 flex make gettext unzip libc6 git-core git build-essential libncurses5-dev zlib1g-dev gawk quilt asciidoc libz-dev subversion

下载openwrt源码(新手不建议下载trunk,不是很稳定)

#使用非root用户登录,建立openwrt目录
mkdir openwrt
#进入openwrt目录
cd openwrt
#下载openwrt的源码
git clone git://git.openwrt.org/15.05/openwrt.git

集成nodogsplash  在/openwrt/feeds.conf.default中添加

src-git nodogsplash https://github.com/nodogsplash/nodogsplash.git

设置权限

sudo chmod -R 777 trunk
cd trunk

更新并安装

./scripts/feeds update -a
./scripts/feeds install -a

根据自己的需要更改系统默认设置,就不细说了,这里列举几个我的设置

#这个目录下可以放置之前openwrt的备份文件,也就是说相当于openwrt的/etc/目录
/home/rophie/openwrt/openwrt/package/base-files/files/etc

#默认wifi设置
package/kernel/mac80211/files/lib/wifi/mac80211.sh

network设置

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.88.1'
	option netmask '255.255.255.0'
	option _orig_bridge 'true'
	option gateway '192.168.88.1'


config globals 'globals'
	option ula_prefix 'fda9:3639:b1e9::/48'

config interface 'wan'
	option ifname 'eth0'
	option _orig_ifname 'eth0'
	option _orig_bridge 'false'
	option proto 'dhcp'

wireless设置  

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
        #这里根据你的USB无线网卡的U口来定
	option path 'platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5:1.0'
	option noscan '1'
	option country 'CN'
	option hwmode '11n'
	option htmode 'HT40'
	option txpower '40'

config wifi-iface
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'APK-YFKJ'
	option encryption psk-mixed
     option key 88888888

nodogsplash设置 

config instance
  # Set to 1 to enable nodogsplash
  option enabled 1

  # Use plain configuration file as well
  #option config '/etc/nodogsplash/nodogsplash.conf'
  option network 'lan'
  option gatewayname 'OpenWrt Nodogsplash'
  option maxclients '250'
  option idletimeout '10'
  option clientforcetimeout '10'
  option redirecturl 'http://192.168.88.1:8080'

  # Your router may have several interfaces, and you
  # probably want to keep them private from the network/gatewayinterface.
  # If so, you should block the entire subnets on those interfaces, e.g.:
  #list authenticated_users 'block to 192.168.0.0/16'
  list authenticated_users 'block to 10.0.0.0/8'

  # Typical ports you will probably want to open up.
  list authenticated_users 'allow tcp port 22'
  list authenticated_users 'allow tcp port 53'
  list authenticated_users 'allow udp port 53'
  list authenticated_users 'allow tcp port 80'
  list authenticated_users 'allow tcp port 443'
  list authenticated_users 'allow tcp port 8080'

  # For preauthenticated users to resolve IP addresses in their
  # initial request not using the router itself as a DNS server,
  list preauthenticated_users 'allow tcp port 53'
  list preauthenticated_users 'allow udp port 53'
  #list preauthenticated_users 'allow tcp port 8080'

  # Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS
  list users_to_router 'allow tcp port 22'
  list users_to_router 'allow tcp port 23'
  list users_to_router 'allow tcp port 53'
  list users_to_router 'allow udp port 53'
  list users_to_router 'allow udp port 67'
  list users_to_router 'allow tcp port 80'
  list users_to_router 'allow tcp port 8080'
  list users_to_router 'allow tcp port 443'

  # See https://github.com/nodogsplash for a full list of available options.

编译配置

#更新版本号
svn up
#进入编译菜单
make menuconfig
Y:选择Y,该软件将被编译,并且加入到你的目标固件里;
M:选择M,该软件包将会被编译,但不会被放入固件里。在需要它的时候,可以用OPKG软件包管理器进行安装;
N:选择N,该软件包将不会被编译,也不会被安装进固件。
方向键是移动光标
回车键是确认
空格键是选择,可以代替Y/M/N键的使用
/:搜索

Target System 选择 brcm2708-bcm2709 按Y选中
需要集成的软件

kmod-usb-core kmod-usb-ohci kmod-usb-uhci kmod-usb2 usbutils kmod-ath kmod-ath9k kmod-ath9k-common kmod-ath9k-htc luci-i18n-base-zh-cn kmod-nls-cp437 kmod-nls-utf8 kmod-fs-vfat kmod-nls-iso8859-1 wireless-tools hostapd

编译

make V=99

很久之后你已经能够在/bin/brcm2708下找到openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img刷机固件了

 

 

 

  

 

转载于:https://www.cnblogs.com/rophie/p/5019266.html

相关文章:

  • 为什么一些公司把dwg文件转化为pdf
  • hadoop生态系统
  • influxDB 变换类函数
  • C# Android 开发中使用 Sqlite.NET ORM
  • 大数据到底怎么学:数据科学概论与大数据学习误区
  • 选项卡TAB
  • 你想快速成为大数据工程师?
  • 【USACO4.2】草地排水Drainage Ditches(最大流)
  • 如何快速学习大数据挖掘分析(个人观点)
  • 人工智能与大数据开发的12个注意事项
  • GuozhongCrawler系列教程 (2) CrawTaskBuilder具体解释
  • 如何利用数据挖掘告别单身
  • 为何大数据开发师的工资能这么高
  • BZOJ2242 SDOI2011 计算器
  • 关于反爬虫,看完这篇文章就够了
  • conda常用的命令
  • CSS盒模型深入
  • IndexedDB
  • Java 实战开发之spring、logback配置及chrome开发神器(六)
  • Java比较器对数组,集合排序
  • Java到底能干嘛?
  • Js基础——数据类型之Null和Undefined
  • js面向对象
  • Mac 鼠须管 Rime 输入法 安装五笔输入法 教程
  • mongodb--安装和初步使用教程
  • mysql innodb 索引使用指南
  • Python打包系统简单入门
  • SpriteKit 技巧之添加背景图片
  • Vue源码解析(二)Vue的双向绑定讲解及实现
  • 从0实现一个tiny react(三)生命周期
  • 搭建gitbook 和 访问权限认证
  • 短视频宝贝=慢?阿里巴巴工程师这样秒开短视频
  • 极限编程 (Extreme Programming) - 发布计划 (Release Planning)
  • 配置 PM2 实现代码自动发布
  • 浅析微信支付:申请退款、退款回调接口、查询退款
  • 收藏好这篇,别再只说“数据劫持”了
  • 想晋级高级工程师只知道表面是不够的!Git内部原理介绍
  • 优化 Vue 项目编译文件大小
  • $forceUpdate()函数
  • (2)nginx 安装、启停
  • (笔试题)合法字符串
  • (分布式缓存)Redis持久化
  • (十三)Java springcloud B2B2C o2o多用户商城 springcloud架构 - SSO单点登录之OAuth2.0 根据token获取用户信息(4)...
  • (一)SpringBoot3---尚硅谷总结
  • (转)fock函数详解
  • (转)linux下的时间函数使用
  • (转)scrum常见工具列表
  • (转载)从 Java 代码到 Java 堆
  • * CIL library *(* CIL module *) : error LNK2005: _DllMain@12 already defined in mfcs120u.lib(dllmodu
  • .babyk勒索病毒解析:恶意更新如何威胁您的数据安全
  • .net refrector
  • .NET/C# 避免调试器不小心提前计算本应延迟计算的值
  • .NET和.COM和.CN域名区别
  • .NET开发不可不知、不可不用的辅助类(三)(报表导出---终结版)
  • .sys文件乱码_python vscode输出乱码