How do I connect to multiple wifi networks? - Ubuntu-PC
https://askubuntu.com/questions/488588/how-do-i-connect-to-multiple-wifi-networks
How can I connect to 2 WiFi networks at the same time with only 1 WiFi-adapter?
I have two separate wireless networks, to which I need to connect the Ubuntu-PC simultaneously: The first with internet access and the other one without internet access.
I tried to create a Virtual Interface and even though there doesn't seem to be an error, it did not appear in the Network Manager. It would seem, the driver I am using, is ath9k:
How can I find out whether my it can create virtual wireless interfaces? Can I replace the driver ath9k, if it doesn't support virtual interfaces?
Yes you can, if your card support it. First of all look the documentation of iw and especially the page of virtual interfaces. Unless you are running 14.04, that is, due to a bug in udev scripts (probably fixed in 15.10, but no confirmation yet).
Note that in the following description wlan0
is my normal WiFi interface and
wlan1
is the name I choosed for the virtual one (it's quite arbitrary). You have to adapt this to your system, of course.
You can create a new virtual interface with:
sudo iw dev wlan0 interface add wlan1 type station
if your adaptor/driver support it, it's done --- you now have two interfaces; otherwise you will have some type of error or the interface will not appear.
You can check if the new interface exists by typing
sudo ifconfig -a
...and see if the wlan1
interface shows up. It will appear in the Network Manager too anyway:
You can remove the virtual interface with
sudo iw dev wlan1 del
I really never used it --- I tried to connect twice to my router and havoc arose (but that probably is normal). Moreover, you will probably need to see if packet forwarding between the two interfaces is enabled by default or not, and you probably need to play a bit with the routing after that. But it's a start.
PD --- one of the thing you will probably have to change is the MAC number of the "virtual" interface, which is by default the same as the other, and will create problems almost for sure.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have found another answer in this topic and it has a little extra just to save some time.
e.g.
About using both interfaces at the same time and the message aboutthem not being unique: This is probably because they both use the sameMAC address. You can try to change the MAC address of the newinterface before activating it.
ip link set dev <dev-name> address <new-mac-address>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通