查了一下資料主要有兩種方法:
第一種: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