shumeipai 4 创建wifi热地

 

(1)sudo apt-get install network-manager

(2)

  1. 将代码clone到本地
    sudo git clone https://github.com/oblique/create_ap
    cd create_ap
    sudo make install
  2. 安装依赖的库
    sudo apt-get install util-linux procps hostapd iproute2 iw haveged dnsmasq
  3. 打开热点(此时,树莓派wifi开着,但没有连wifi)
    sudo create_ap wlan0 eth0 热点名 密码
  4. 此时不出意外热点将会开启,但是会有warn,可以执行以下代码
    sudo create_ap --no-virt wlan0 eth0 m热点名 热点
  5. sudo create_ap --no-virt wlan0 eth0 chenredian 12345678

     

  6. 以服务方式启动,执行开机自启
    #1.修改服务配置,添加--no-virt参数
    sudo nano /usr/lib/systemd/system/create_ap.service
    # 将
    ExecStart=/usr/bin/create_ap --config /etc/create_ap.conf
    # 修改为 
    ExecStart=/usr/bin/create_ap --no-virt --config /etc/create_ap.conf
    
    #2.默认配置文件/etc/create_ap.conf,将下面两横改为自己的ssid和密码即可,修改自己的dhcp网关
    sudo nano /etc/create_ap.conf
    # 将
    GATEWAY=10.0.0.1
    SSID=MyAccessPoint
    PASSPHRASE=12345678 
    # 修改为
    GATEWAY=192.168.10.1
    SID=chenredian
    PASSPHRASE=12345678
    
    # 启动一个服务:
    systemctl start create_ap.service
    # 关闭一个服务:
    systemctl stop create_ap.service
    # 重启一个服务:
    systemctl restart create_ap.service
    # 显示一个服务的状态:
    systemctl status create_ap.service
    # 在开机时启用一个服务:
    systemctl enable create_ap.service
    # 在开机时禁用一个服务:
    systemctl disable create_ap.service
    # 查看服务是否开机启动:
    systemctl is-enabled create_ap.service

     设置为开机启动 

    
    # 启动一个服务:
    systemctl start create_ap.service
    # 在开机时启用一个服务:
    systemctl enable create_ap.service
    

    关闭改服务

  7. 
    
    # 关闭一个服务:
    systemctl stop create_ap.service
    # 在开机时禁用一个服务:
    systemctl disable create_ap.service
    # 查看服务是否开机启动:
    systemctl is-enabled create_ap.service

     

  8. 异常一:WARN: brmfmac driver doesn't work properly with virtual interfaces and it can cause kernel panic. For this reason we disallow virtual interfaces for your adapter.For more info: https://github.com/oblique/create_ap/issues/203
    ERROR: Your adapter can not be a station (i.e. be connected) and an AP at the same time
    处理:sudo nmcli dev dis wlan0
  9. 异常二:

    sudo create_ap wlan0 eth0 my_raspi 88166908
    WARN: brmfmac driver doesn't work properly with virtual interfaces and it can cause kernel panic. For this reason we disallow virtual interfaces for your adapter. For more info: https://github.com/oblique/create_ap/issues/203 WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Config dir: /tmp/create_ap.wlan0.conf.cDxIozig PID: 1132 Network Manager found, set wlan0 as unmanaged device... DONE/bin/create_ap: line 1669: dnsmasq: command not found

    ERROR: Wrong version format!

    处理:
    
    sudo yum install dnsmasq -y
  10. 异常三:

    sudo create_ap wlan0 eth0 my_raspi 12345678
    WARN: brmfmac driver doesn't work properly with virtual interfaces andit can cause kernel panic. For this reason we disallow virtual interfaces for your adapter. For more info: https://github.com/oblique/create_ap/issues/203 WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Config dir: /tmp/create_ap.wlan0.conf.gC5KSqVQ PID: 2497 Sharing Internet using method: nat hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.gC5KSqVQ/hostapd_ctrl Configuration file: /tmp/create_ap.wlan0.conf.gC5KSqVQ/hostapd.conf

    处理:
    sudo create_ap --no-virt wlan0 eth0 my_raspi 12345678

     

    Failed to create interface mon.wlan0: -95 (Operation not supported)

你可能感兴趣的:(shumeipai 4 创建wifi热地)