查了一下資料主要有兩種方法:php
這種方法配置比較複雜.而且不能給Android手機和iPhone共享.果斷放棄(其實我是嘗試過的,真的沒有用).android
這種方法配置簡單,用起來也方便.git
第一步:安裝ap-hotspotweb
$ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt-get update $ sudo apt-get install hostapd $ sudo apt-get install ap-hotspot
第二步:配置ap-hotspotubuntu
$ 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的密碼
第三步:啓動wifiless
$ sudo ap-hotspot start
大功告成,如今能夠再Android設備上查找到本身發散的wifi了this
另外附上幾個經常使用的命令選項:spa
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,竟然神奇地能夠用了。.net
解釋一下ap-hotspot和hostapd的關係把,其實ap-hostpot是依賴hostapd的,至關於ap-hostpot只是個充當客戶端的角色,hostapd纔是核心,所以hostapd出了問題ap-hostpot天然也用不了了。debug
太折騰了。。。。。
須要手動下載源碼編譯的戳這裏 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/