Ubuntu14.04 设置wifi热点

查了一下资料主要有两种方法:

第一种:network manager设置

  这种方法配置比较复杂.并且不能给Android手机和iPhone共享.果断放弃(其实我是尝试过的,真的没有用).

第二种:使用ap-hotspot,亲测可用

  这种方法配置简单,用起来也方便.

  第一步:安装ap-hotspot

 

$ sudo add-apt-repository ppa:nilarimogard/webupd8

$ sudo apt-get update

$ sudo apt-get install hostapd

$ sudo apt-get install ap-hotspot

 

 

 

  第二步:配置ap-hotspot

$ sudo ap-hotspot configure
Detecting configuration...
Detected eth0 as the network interface connected to the Internet. Press ENTER if this is correct or enter the desired interface below (e.g.- eth0, ppp0 etc.):
// 回车确认

Detected wlan0 as your WiFi interface. Press ENTER if this is correct or enter the desired interface (e.g.- wlan1):
// 回车确认

Enter the desired Access Point name or press ENTER to use the default one (myhotspot):
// 输入wifi的名字

Enter the desired WPA Passphrase below or press ENTER to use the default one (qwerty0987):
// 输入wifi的密码

 

  第三步:启动wifi

$ sudo ap-hotspot start

 

大功告成,现在可以再Android设备上查找到自己发散的wifi了

 

另外附上几个常用的命令选项:

Usage:    ap-hotspot [argument]

    start          start wireless hotspot        // 打开wifi
    stop           stop wireless hotspot         // 停止wifi
    restart        restart wireless hotspot      // 重启wifi
    configure      configure hotspot             // 配置wifi
    debug          start with detailed messages  // dubug模式打开wifi,会显示一些详细的信息

 

以前会出现一个一直处于starting...状态的问题,但是,但是尼玛流行的修复方式出了问题了!官网脑残地将hostapd 1.0的deb包删除了,现在的2.x的包尼玛根本不能用。我下载了1.0和2.x版本编译安装还是不行,后来还是用的ubuntu官网的hostapd,居然神奇地可以用了。

解释一下ap-hotspot和hostapd的关系把,其实ap-hostpot是依赖hostapd的,相当于ap-hostpot只是个充当客户端的角色,hostapd才是核心,因此hostapd出了问题ap-hostpot自然也用不了了。

太折腾了。。。。。

需要手动下载源码编译的戳这里 http://w1.fi/cgit/hostap-1/

下载2.x的deb包的戳这里:http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/ 然而这并没有什么卵用。

本文参考了:

http://ubuntuhandbook.org/index.php/2014/02/wifi-hotspot-ubuntu-laptop-android/

http://blog.csdn.net/wdjhzw/article/details/39118651

 

posted @ 2015-04-11 23:24  csulennon  阅读(10705)  评论(5编辑  收藏  举报