Linux连接wifi同时开启热点

实例:连接校园网并开启热点

条件:网卡需要支持ap模式

1.连接校园网wifi 

     

#开启无线接口
sudo ip link set wlan0 up
#扫描wifi,获取wifi列表
sudo iw dev wlan0 scan |grep SSID
sudo iw dev wlan0 connect #连接 后面加wifi SSID

连接上后如需要认证,请自行认证。

如果网络使用的是 WPA 或 WPA2 协议的话,需要使用wpa_supplicant 。此处连接校园网不涉及。

2.开启热点

#!/bin/bash

# 加虚拟网络接口并设置网卡地址
sudo iw dev wlp9s0 interface add wlan1 type __ap
sudo ip link set dev wlan1 address 22:33:ss:dd:66:00

# 使用create_ap开启热点,工具可在https://github.com/oblique/create_ap/获取
sudo create_ap -c 11 wlan1 eth0 SSID passwowd

 

 

 

虚拟借口开启热点参考:https://www.zhihu.com/question/24961490

posted @ 2018-03-09 19:55  smileinwind  阅读(6570)  评论(0编辑  收藏  举报