Linux系统设置WiFi热点

来源:互联网 发布:java生成随机数 编辑:程序博客网 时间:2024/05/22 08:12

方法一:

第一步:安装hostapd

      sudo apt-get install hostapd

第二步:安装创建热点脚本(下载地址:http://download.csdn.net/download/hanbo622/9553371)

      进入create_ap-master目录直接make

第三步:创建热点

      create_ap wlan0 eth0 hanbo -w2 12345678 &

            create_ap:创建热点脚本

            wlan0:WiFi网卡

            eth0:有线网卡

            hanbo:热点名称

            -w2: 加密方式WPA2

            12345678:密码

            &:后台运行

 

方法二:

第一步:安装hostapd

      sudo apt-get install hostapd

第二步:安装ap-hotspot

      sudo apt-get install ap-hotspot

      注意:如果安装失败,执行如下语句再安装

            sudo add-apt-repository ppa:nilarimogard/webupd8

            sudo apt-get update

第三步:ap-hotspot使用说明

      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,会显示一些详细的信息

第四步:AP配置

      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

          Starting Wireless Hotspot...
          Wireless Hotspot active 

注意:如果在调试过程中 ap-hotspot start 出现 “Another process is already running” 

            ap-hotspot stop 无效问题

           可以sudo rm /temp/hotspot.pid 删掉已启动的进程

附:

      如果执行 "sudo ap-hotspot  start"后出现 "Starting Wireless Hotspot..."不动了,就是hostapd出现了问题

下载源码编译安装:http://download.csdn.net/download/hanbo622/9556564 (版本:hostap-1-hostap_1_1.tar.gz)

      a、tar -xvf hostap-1-hostap_1_1.tar.gz

      b、cd  hostap-1-hostap_1_1/hostapd

      c、cp defconfig .config

      d、安装编译环境

            apt-get install libnl-dev libpopt-dev openssl libssl-dev build-essential

      e、make

      f、make install (此安装就是把hostapd和hostapd_cli放到了/usr/local/bin中)

      g、cp  hostapd  hostapd_cli  /usr/sbin (这是替换掉apt-get install hostapd安装的程序,建议使用)

 

 

0 0
原创粉丝点击