Community discussions

MikroTik App
 
phdoerfler
just joined
Topic Author
Posts: 18
Joined: Sat Sep 04, 2021 3:40 pm

Bridge an existing Wifi to LAN

Sat Sep 04, 2021 3:53 pm

tl;dr: There is wifi. There's an ethernet cable. I want my Mikrotik device to bridge¹ the two together. There's a DHCP server in the wifi network which I'd like to use. Same goes for the gateway behind which lies the internet.

Longer version:
Say you are renting a holiday home for a week or two and you were promised wifi.
The wifi exists, but only in one room whereas in the rest of the home it is… lacking.

I have had that happen in the past twice with a group of friends and eventually we would set up a router or laptop so it would connect to the guest wifi and bridge it to LAN, then we'd have a very long lan cable to a switch on the table we'd work or game on. In one instance we used a pair of powerline adapters to bridge the gap instead of the ethernet cable.

In all cases it was quite fiddly either requiring some linux command line fu and a spare notebook or hours of frustration dealing with, e.g., dd-wrt on a router.

I bet with a hAP ac 3 or similar and a few lines of routerOS config, this should be quite easy. However, I'm still very new to RouterOS so any help would be very appreciated!

Thanks!

Here's my config so far:
# model = RBD53iG-5HacD2HnD
/interface bridge
add name=bridge1
/interface bridge port
add bridge=bridge1 interface=all
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/ip dhcp-client
add disabled=no interface=bridge1
/system identity
set name=hap-bridge
Do I only need to add tell the wireless interface to be a client of the foreign wifi and that's it then? How would I do that?

¹ Not necessarily via bridging. I will gladly take anything that gets the job done but I believe "bridging" is what I ultimately want, right?
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 723
Joined: Tue Dec 17, 2019 1:08 pm

Re: Bridge an existing Wifi to LAN

Thu Sep 09, 2021 2:44 pm

If you don't need L2-Connectivity with the "holiday home" Network...
I would create a my own Network with the CAP ac3 and use wlan1 as WAN

Step 1: Create Bridge
/interface bridge
add name=bridge1
/interface bridge port
add bridge=bridge1 interface=ether1
add bridge=bridge1 interface=ether2
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether5
add bridge=bridge1 interface=wlan2
Step 2: Create Network and Services
/ip address
add address=10.10.10.254/24 interface=bridge1 network=10.10.10.0
/ip pool
add name=dhcp_pool0 ranges=10.10.10.1-10.10.10.199
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=bridge1 name=dhcp1
/ip dhcp-server network
add address=10.10.10.0/24 dns-server=192.168.178.254,10.10.10.254 gateway=10.10.10.254
/ip dns
set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
Step 3: Create WAN
/interface wireless security-profiles
add authentication-types=wpa2-psk eap-methods="" mode=dynamic-keys name="holiday home" supplicant-identity="" wpa2-pre-shared-key="somepassword"
/interface wireless
set wlan1 band=2ghz-b/g/n disabled=no mode=station frequency=auto security-profile="holiday home" ssid="holiday home SSID"
/ip dhcp-client
add disabled=no interface=wlan1
/ip firewall nat
add action=masquerade chain=srcnat out-interface=wlan1
Step 4: Configure wlan2 as needed
Step 5: Check if everything ist working
Step 6: Secure Router (Password, firewall etc..)
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: Bridge an existing Wifi to LAN

Thu Sep 09, 2021 3:14 pm

¹ Not necessarily via bridging. I will gladly take anything that gets the job done but I believe "bridging" is what I ultimately want, right?

Actually you probably can't do it by joining your wired LAN to landlord's network in L2 (ethernet). Original 802.3 standard did not allow for proper bridging of two wired islands. Different vendors came up with their own (largely incompatible) extensions to overcome this problem. Which means that in general this kind of operation is only possible between two products of same vendor. More discussion is in this article.

Generally you would use your mikrotik as a router. Usually it's configured to use ether1 as WAN interface, in your case you want to use wlan1 (or wlan2 depending on frequency band used by landlord's wireless network) as WAN interface. If you performed full device reset, then the basic mode of operation you would like to have is "CPE" (usually it's HomeAP or something). Some discussion about QuickSet modes.

Alternatively you can start off using the usual "HomeAP dual" config. Remove wlan1 (or wlan2) from bridge, configure it as per bullet #3 (minus the NAT part) of previous post and add it to WAN interface list (/interface list member).
 
phdoerfler
just joined
Topic Author
Posts: 18
Joined: Sat Sep 04, 2021 3:40 pm

Re: Bridge an existing Wifi to LAN

Mon Sep 13, 2021 1:40 pm

Thanks a bunch! I got it to work and it works quite well!
Also thanks for explaining the problem with bridging. That explains a lot, actually.

I also toyed around with bridging the 2.4 and 5 GHz wlan together hoping this would make the hap use both radios to connect to the foreign wifi but only one of them ever got an IP address from the DHCP server and that caused many problems.
I'll look into the quickset dual config, sounds like it does what I want it to.

Alternatively, I might leave it at using only one radio to connect to the foreign wifi and use the other radio to create a local wifi.

Again, thanks for your help!
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: Bridge an existing Wifi to LAN

Mon Sep 13, 2021 2:35 pm

If you want to use both wireless interfaces to connect to same AP and use them in parallel, you're after bonding ... but that requires configuration on both ends. While bonding in RouterOS is pretty versatile, I'd be surprised if you could do it on AP of a random vendor.
 
phdoerfler
just joined
Topic Author
Posts: 18
Joined: Sat Sep 04, 2021 3:40 pm

Re: Bridge an existing Wifi to LAN

Tue Sep 14, 2021 10:15 am

Hu, I had no idea, thanks for clarifying! That was indeed what I was after.

However, thinking about it more, what about the hap switching between 2.4 vs. 5Ghz depending on what's better, just like smartphones etc. do? It would be using only one radio for connecting to the foreign wifi at the same time. Is that hard to do? Where can I find how to do that?
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: Bridge an existing Wifi to LAN

Tue Sep 14, 2021 12:29 pm

Generally switching between 2.4GHz and 5GHz is done solely on basis of signal strength (current throughput does not count as decision criteria) and that's true for all wireless devices (OK, perhaps there are some advanced devices extending what WiFi 802.11 standard defines that can do it more intelligently). And no, Mikrotik is not anything special with this regard, I'm not sure it will even switch between the radios if both are configured as clients to the same SSID and previously used frequency band goes silent ...

Who is online

Users browsing this forum: No registered users and 37 guests