編譯樹莓派2代B型OpenWrt韌體實現無線路由器及nodogsplash認證功能,openwrtnodogsplash

來源:互聯網
上載者:User

編譯樹莓派2代B型OpenWrt韌體實現無線路由器及nodogsplash認證功能,openwrtnodogsplash

最終功能:

無線路由器的主要功能,網口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 trunkcd 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-ifaceoption 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 menuconfigY:選擇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刷機韌體了

 

 

 

  

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.