新聞中心
Debian如何開WI-FI熱點?本篇文章將在Debian中為大家演示一下Debian中開WI-FI熱點具體方法,有需要的小伙伴可以參考一下。

創(chuàng)新互聯(lián)憑借在網(wǎng)站建設(shè)、網(wǎng)站推廣領(lǐng)域領(lǐng)先的技術(shù)能力和多年的行業(yè)經(jīng)驗,為客戶提供超值的營銷型網(wǎng)站建設(shè)服務(wù),我們始終認為:好的營銷型網(wǎng)站就是好的業(yè)務(wù)員。我們已成功為企業(yè)單位、個人等客戶提供了成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)服務(wù),以良好的商業(yè)信譽,完善的服務(wù)及深厚的技術(shù)力量處于同行領(lǐng)先地位。
安裝環(huán)境
操作系統(tǒng):Debian Gnu/Linux 8.3 內(nèi)核: linux-image-4.3.0-0.bpo.1-amd64 網(wǎng)卡:騰達(Tenda) W311M 150M Mini無線USB網(wǎng)卡
1、準(zhǔn)備環(huán)境
添加源倉庫
執(zhí)行vi /etc/apt/sources.list,并添加如下源地址:
deb http://ftp.cn.debian.org/debian/ jessie-backports main contrib non-free
安裝依賴軟件包
安裝最新內(nèi)核及相關(guān)軟件組件包,避免編譯Hostapd出錯,依次執(zhí)行如下命令:
apt-get update
apt-get install linux-image-4.3.0-0.bpo.1-amd64
apt-get install linux-headers-4.3.0-0.bpo.1-all-amd64
apt-get install pkg-config
apt-get install libssl-dev
apt-get install gettext
apt-get install openssl
apt-get install libnl-genl-3-dev
apt-get install libnl-genl-3-200
apt-get install libnl-3-dev
apt-get install libnl-3-200
apt-get install hostapd
2、編譯、配置hostapd軟件
下載hostapd軟件包
進入http://w1.fi/hostapd/網(wǎng)站下載hostapd-2.5.tar.gz文件
wget http://w1.fi/releases/hostapd-2.5.tar.gz
解壓
解壓并復(fù)制配置文件
tar -zxvf hostapd-2.5.tar.gz
cd hostapd-2.5
cp defconfig .config
使用vi .config命令對該文件進行修改,修改內(nèi)容如下:
# Use libnl v2.0 (or 3.0) libraries.
CONFIG_LIBNL20=y
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
CONFIG_LIBNL32=y
# IEEE 802.11n (High Throughput) support
CONFIG_IEEE80211N=y
保存退出,編譯安裝:
make
make install
系統(tǒng)將在/usr/local/bin目錄下生成兩個文件名為hostapd、hostapd_cli的可執(zhí)行文件。
修改配置文件參數(shù)
將hostapd配置文件復(fù)制到/etc/hostapd/文件夾下,并將相關(guān)字段修改為如下內(nèi)容:
cp hostapd.conf /etc/hostapd/
vi /etc/hostapd/hostapd.conf
interface=wlan1
driver=nl80211
ssid=LONUXPROBE
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wmm_enabled=1
ieee80211n=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
wpa=2
wpa_passphrase=linuxprobe
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
修改守護進程目標(biāo)位置
使用vi對該文件進行編輯,修改內(nèi)容如下:
vi /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
修改服務(wù)腳本目標(biāo)位置
對hostapd服務(wù)腳本進行編輯,修改內(nèi)容如下:
vi /etc/init.d/hostapd
DAEMON_SBIN=/usr/local/bin/hostapd
并在start)下一行添加如下內(nèi)容:
sed -i '/\[keyfile\]/a unmanaged-devices=mac:c8:3a:35:cb:18:e0' /etc/NetworkManager/NetworkManager.conf
ip addr add 192.168.11.1/24 dev wlan1
echo "1" >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sleep 2
在stop)下一行添加如下內(nèi)容:
sed -i '/^unmanaged-devices=mac:c8:3a:35:cb:18:e0/d' /etc/NetworkManager/NetworkManager.conf
echo "0" >/proc/sys/net/ipv4/ip_forward
ip addr del 192.168.11.1/24 dev wlan1
iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
sleep 2
在reload)下一行添加如下內(nèi)容:
sed -i '/^unmanaged-devices=mac:c8:3a:35:cb:18:e0/d' /etc/NetworkManager/NetworkManager.conf
echo "0" >/proc/sys/net/ipv4/ip_forward
ip addr del 192.168.11.1/24 dev wlan1
iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
sed -i '/\[keyfile\]/a unmanaged-devices=mac:c8:3a:35:cb:18:e0' /etc/NetworkManager/NetworkManager.conf
ip addr add 192.168.11.1/24 dev wlan1
echo "1" >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sleep 2
保存退出,**(根據(jù)自己情況設(shè)定參數(shù)mac和ip)**對腳本文件進行重新配置:
systemctl daemon-reload
3、安裝并配置dnsmasq軟件
安裝dnsmasq
apt-get install dnsmasq
修改dnsmasq的配置文件
vi /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq.conf
server=/cn/114.114.114.114
server=/taobao.com/114.114.114.114
server=/google.com/8.8.8.8
listen-address=127.0.0.1,192.168.11.1
dhcp-range=192.168.11.50,192.168.11.150,12h
dhcp-option=3,192.168.11.1
dhcp-option=6,192.168.11.1
cache-size=1024
conf-dir=/etc/dnsmasq.d
修改配置文件
vi /etc/resolv.dnsmasq.conf
nameserver 114.114.114.114
nameserver 223.5.5.5
nameserver 223.6.6.6
修改配置文件
vi /etc/resolv.conf
nameserver 127.0.0.1
4、啟動相關(guān)服務(wù)
啟動服務(wù)
分別使用命令:
systemctl enable dnsmasq.service
systemctl disable hostapd.service
開啟和關(guān)閉兩項服務(wù),之后在需要使用熱點模式時使用命令:
systemctl start hostpad.serive
用戶即可使用熱點名為LINUXPROBE,密碼為linuxprobe,網(wǎng)關(guān)地址和DNS均為192.168.11.1的80211N協(xié)議無限熱點進行上網(wǎng)連接啦!
名稱欄目:Debian中開WI-FI熱點具體方法
文章出自:http://www.dlmjj.cn/article/dpdiipg.html


咨詢
建站咨詢
