2021-03-04 14:10:56

by Joshua Zhao

[permalink] [raw]
Subject: bridge mac80211_hwsim AP to internet?

Hi,
I'm using mac80211_hwsim to simulate a virtual STA and a virtual AP.
How can I bridge the virtual AP to a backhaul link on my PC (e.g. a
physical ethernet link) for real internet connection? i.e. so that my
virtual STA can access the internet. The AP could be configured in
NAT mode or layer-2 bridge mode. Is it possible/supported?

Many thanks!
Joshua


2021-03-04 15:32:40

by Johannes Berg

[permalink] [raw]
Subject: Re: bridge mac80211_hwsim AP to internet?

On Wed, 2021-03-03 at 16:06 -0800, Joshua Zhao wrote:
> Hi,
> I'm using mac80211_hwsim to simulate a virtual STA and a virtual AP.
> How can I bridge the virtual AP to a backhaul link on my PC (e.g. a
> physical ethernet link) for real internet connection? i.e. so that my
> virtual STA can access the internet. The AP could be configured in
> NAT mode or layer-2 bridge mode. Is it possible/supported?

Just like on a normal AP? Create a bridge interface (e.g. brctl) and add
the AP and backhaul interface to it. Use IP assignment etc. on the
bridge and configure hostapd accordingly to know about it.

johannes