Deepin用Create_ap创建热点方法
Tofloor
poster avatar
comzhong
deepin
2016-10-29 20:45
Author
本帖最后由 comzhong 于 2017-10-4 22:16 编辑

Create_ap创建热点对于新手来说够折腾一下了,网上的教程千差万别,不同的Linux版本也有一定的差别,看起来简单的几个命令,拿到手却用不了,现在给出Deepin用Create_ap脚本建立热点的方法,高手路过就好
总共三步
  1. 一、网卡选择,看网卡是不是支持AP
  2. 二、hostapd、create_ap安装
  3. 三、创建热点
Copy the Code

一、网卡选择,看网卡是不是支持AP

首先用ifconfig找到网卡接口名称

  1. ifconfig|cut -d':' -f1
Copy the Code
解释:
ap0:是我用create_ap命令创建出来的ap
enp5s0f5:有线网卡
lo:暂时不清楚
ppp0:这个用ADSL上网的话就会出现
wlp4s0:无线网卡
当你没有使用create_ap创建ap时,ifconfig命令不会返回ap0,当你没有使用ADSL上网时(路由器LAN口直连)不会有ppp0


不同于windows上,大部分的网卡都支持软AP ,linux下的网卡需要支持mode master的才可以做软AP 。具体识别方法如下:
1、iwconfig识别
  1. sudo iwconfig wlp4s0 mode master
Copy the Code


2、iw识别
上面的操作失败,证明不支持。再进行进一步的验证,有些新的网卡用的是mac80211 framework,对于这些网卡的话,用iwconfig来测试它是否支持master模式是行不通的。
因为他们是使用新的 nl80211接口在用户空间通信的。再使用iw命令进行测试:

  1. sudo iw list|grep "* AP"|cut -d' ' -f3|sed  -n "1,2p"
  2. sudo iw list|grep "(no IR)"|cut -d' ' -f4
Copy the Code

3、驱动识别
安装ethtool

  1. sudo apt-get install ethtool
  2. sudo ethtool -i wlp4s0
Copy the Code

例如上面的示例中使用的驱动为ath9k,通过http://wireless.kernel.org/en/users/Drivers http://linuxwireless.org/en/users/Drivers/
AP模式支持的驱动列表里的查找ath9k,查看AP项为yes的,证明支持软AP。

即然如此,如何在未购买网卡前选择一款一定支持的网卡呢?wireless.kernel.org也给我们提供了一个方法 ,通过http://wireless.kernel.org/en/users/Devices  硬件列表 (该页按pci、usb、pcmcia接口类型做了区分,点开相应的类型即可查看具体的硬件)。当然,这个表里列出的并不完全,也并不能保证是最适合做软AP的硬件 。是否识合请参查看上面的三个方法。

二、hostapd、create_ap安装
1.安装软件,其中haveged不是必须的
  1. sudo apt-get install hostapd dnsmasq haveged
Copy the Code

2.下载create_ap脚本,安装脚本。
  1. sudo apt-get install git
Copy the Code

三、创建热点
建立一个 WPA + WPA2 认证的热点,这里无线网卡已经连接WiFi正常上网了,所以Internet网络访问的接口同名,如果ppp0宽带拨号接口上网,命令为:sudo create_ap wlp4s0 ppp0 Deeepin_AP 123456789,

wlp4s0是无线网卡接口
Deeepin_AP是热点SSID
123456789是密码

  1. sudo create_ap wlp4s0 wlp4s0 Deeepin_AP 123456789 &
Copy the Code

成功建立热点,连接热点上网正常,使用热点期间不可关闭此终端。这里再次提醒,disable的信道不能用于建AP,如果而且如果无线网卡已经连接WiF且正好使用disable的信道,也不能成功创建AP,比如用13信道会提示错误:ERROR: Your adapter can not transmit to channel 13, frequency band 2.4GHz.,可以将WiFi的信道改为非disable的信道,不要问我为什么。
关闭热点
  1. sudo create_ap --stop wlp4s0
Copy the Code

感谢http://blog.csdn.net/cupidove/article/details/38845049,你也可以参考它试试不用create_ap脚本,手动使用hostapd+dnsmasq配置

Reply Favorite View the author
All Replies
jingle
deepin
2016-10-29 21:12
#1
nice
Reply View the author
tpx
deepin
2016-11-13 09:10
#2
hostapd not found.
楼主这个问题怎么解决
Reply View the author
comzhong
deepin
2016-11-13 09:37
#3
https://bbs.deepin.org/post/45024
hostapd not found.
楼主这个问题怎么解决

你没看到吗?
sudo apt-get install hostapd dnsmasq haveged
Reply View the author
tpx
deepin
2016-11-14 01:19
#4
https://bbs.deepin.org/post/45024
你没看到吗?
sudo apt-get install hostapd dnsmasq haveged

还是无法定位软件包 hostpad
Reply View the author
retaw
deepin
2016-11-14 01:43
#5
https://bbs.deepin.org/post/45024
还是无法定位软件包 hostpad

先sudo apt-get update
Reply View the author
tpx
deepin
2016-11-14 23:13
#6
https://bbs.deepin.org/post/45024
先sudo apt-get update

还是不行,还是无法定位软件包。。也是醉了
Reply View the author
comzhong
deepin
2016-11-14 23:43
#7
本帖最后由 comzhong 于 2016-11-14 19:39 编辑
https://bbs.deepin.org/post/45024
还是不行,还是无法定位软件包。。也是醉了

不行就手动下安装包hostapd_v2.5-2 v2.4-2_amd64.zip,或者下源码包编译:http://w1.fi/hostapd/hostapd-2.6.tar.gz
Reply View the author
retaw
deepin
2016-11-15 03:24
#8
https://bbs.deepin.org/post/45024
还是不行,还是无法定位软件包。。也是醉了

你拼错了,hostapd。。也是醉了
Reply View the author
Comments
comzhong
2016-11-15 03:40
O(∩_∩)O哈哈~
Ssxfc
deepin
2017-10-13 17:47
#9
成功创建 受教了 谢谢大佬
Reply View the author
great
deepin
2017-10-14 01:21
#10
的确方法很好
Reply View the author
serenity
deepin
2018-03-22 17:53
#11
测试成功谢谢  大佬   

希望官方能支持    官方带的热点功能开启后,会关闭wifi功能,不能ap无线
Reply View the author
187******47
deepin
2022-03-27 03:36
#12

楼主你好,驱动识别,在http://wireless.kernel.org/en/users/Drivers发现不支持AP,这种情况怎么看热点?

3、驱动识别
安装ethtool

  1. sudo apt-get install ethtool
  2. sudo ethtool -i wlp4s0

Copy the Code

例如上面的示例中使用的驱动为ath9k,通过http://wireless.kernel.org/en/users/Drivers http://linuxwireless.org/en/users/Drivers/
AP模式支持的驱动列表里的查找ath9k,查看AP项为yes的,证明支持软AP。

Reply View the author