1

This is the usual "I want to bridge wifi with ethernet" question, but I need something specific here.

My Linux box has a wlan0 interface which is in station mode, with MAC aa:aa:aa:aa:aa:aa, and a VLAN interface (vlan0) with MAC bb:bb:bb:bb:bb:bb. Only one specific host is talking to me over the VLAN, so all packets arriving from the VLAN will have source MAC address cc:cc:cc:cc:cc:cc.

And due to the three-address framing in WiFi, all packets arriving from wlan0 will have destination MAC address aa:aa:aa:aa:aa:aa. Is this right, or am I oversimplifying?


What I want to do is a simple MAC NAT bridge, in which:

  1. A packet coming from wlan0 gets its destination MAC changed to cc:cc:cc:cc:cc:cc and blindly sent through VLAN.

    Got from wlan0                       Sent through vlan0
    SRC: whatever it is                  SRC: whatever it is
    DST: aa:aa:aa:aa:aa:aa      -->      DST: cc:cc:cc:cc:cc:cc
    (payload)                            (payload)
    
  2. A packet coming from vlan0 gets its source MAC changed to aa:aa:aa:aa:aa:aa and blindly sent through wlan0.

    Sent through wlan0                   Got from vlan0
    SRC: aa:aa:aa:aa:aa:aa               SRC: cc:cc:cc:cc:cc:cc
    DST: whatever it is         <--      DST: whatever it is
    (payload)                            (payload)
    
  3. Incoming ARP replies from vlan0 also get the ARP MAC updated. Example:

    Sent through wlan0                   Got from vlan0
    SRC: aa:aa:aa:aa:aa:aa               SRC: cc:cc:cc:cc:cc:cc
    DST: whatever it is         <--      DST: whatever it is
    1.2.3.4 can be found at              1.2.3.4 can be found at
    aa:aa:aa:aa:aa:aa                    cc:cc:cc:cc:cc:cc
    

ebtables sounds like the perfect way to do this... if only I could bridge the two interfaces together.
Any idea? I've heard about relayd, could that help?

  • Note: neither wlan0 nor vlan0 have IPv4 or IPv6 setup, so the box itself won't output any IP packets to them. – Alba Mendez Dec 13 '14 at 11:35
  • This sounds really messy. Probably too messy to use in production. What is the business goal here? Why can't you just route normally? – Michael Hampton Dec 13 '14 at 17:17
  • This can sound messy, but it's actually a lot more simple than the ARP-NAT hack, frequently used to "bridge" an WLAN station. – Alba Mendez Dec 13 '14 at 18:44
  • I cannot route nor NAT because the remote host (the one on the other end of the VLAN) needs to talk directly to the AP. – Alba Mendez Dec 13 '14 at 18:45
  • This article does just what I want (MAC NAT) with ebtables, but it says you can bridge the two interfaces together, which is no longer true. – Alba Mendez Dec 13 '14 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.