OpenWrt Forum Archive

Topic: relayd configuration help, bridge a secondary wifi network to wan

The content of this topic has been archived on 27 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I want my openwrt to do two things:
* provide a usual masqueraded LAN (lan+wifi_1), with a wan using dhcp on the routers mac-address (WORKING)
* have a second wifi network (wifi_2), which should look like a switch from wan to the clients there (PARTIALLY)

It's a bit weird, I know. But it would save me a lot of time if I could just switch the wifi network to get the dhcp-address for my laptop's mac address. And yes, I really want it bridged/switched to the Internet.

I made a picture, hope it clarify's it. btw: sorry for my bad english, I hope you understand my question smile
http://i46.tinypic.com/16kt4e0.png

what I've got working:
* LAN/wifi_1 is working, and is connected to the internet with an dhcp-Address on wan
* wifi_2 is bridged to wan using relayd (i used the Luci-Method to configure, not that hard)
* I get the correct public dhcp address when connecting my computer to wifi_2
* I can get to the internet using wifi_2

what is NOT working:
* wifi_2 uses the IP of the openwrt-router to connect to the internet.
  I want my laptop to be transparently bridged (or "switched") to the internet link.


I could also draw a diagram, how my configuration looks like (but this is much more work, i have to do that in the evening if you ask me so)

Do you have an idea how I could use two different routes to the internet for two networks?
I also looked into Multi-WAN, which doesn't seem to be the right direction as I could not set a source interface.
Maybe it's just a iptables thing - I don't know.

Thanks for any help, I got stuck there smile
regards, Florian.

--- oh sorry, I missed that:
it's Attitude Adjustment 12.09-rc1 on a TP-Link TL-WR1043N/ND v1

(Last edited by laggflor on 8 Jan 2013, 16:28)

you write about a masqueraded LAN but in actual fact the masquerading is done on the WAN interface. Through that physical interface a tunnel is established that creates the virtual interface, e.g. called pppoe-wan. The masquerade, when defined in its basic form, will make anything coming through the pppoe-wan appear to have the source address that was dynamically assigned by the ISP. So what you want, to make the wifi_2 appear under its real address on the internet cannot work without limiting the masquerade action to certain source addresses only.
BUT, in my experience, given the scarcety of IP addresses, the ISP will also do a masquerade in the concentrator so that anything coming from that client of theirs seems to be coming from the single dynamically assigned address anyway. So your y/n masquerade choice only influences whether the ISP can see that different appliances are being used. This will remain shielded from the internet though, regardless of your choice. The ISP cannot afford to reserve a whole subnet for you to make sure the answers from the internet are guided back properly and all end up in your router for any choice of address within the subnet range.

First, thank your for your quick answer.

The ISP is a local ISP, and I do most configuration work for them, so no problem here. We also have some Routers with multiple IP's seperated by VLAN's, but none on OpenWRT and it's a bit different here with the relayd config. This is the main reason why I want that setup, for testing and Setup devices with there public IP as they were directly connected to the network. Well I Know, a second cable could that do too, but that isn't possible. And I do not want to sit in that cold room where the Router is all the time smile And I want to show it's possible smile

So, if I understood you right it's a problem with the masquerading (which seems right, dont know why I didn't see that).
Is there a possibility I could add a virtual Switch (or bridge, whatever) and do the masqerading on a virtual wan interface behind it? Like that?
http://i46.tinypic.com/qqqyzc.png

Thanks!

----- EDIT -----
OMG, PLEASE ignore, how I wrote 'bridge'! hmm

(Last edited by laggflor on 8 Jan 2013, 19:38)

The way the contact is made to the ISP remains unclear to me; was assuming adsl but apparently not. More precise info needed.

Btw i cannot understand why you need relayd at all..
Cant you bridge it to the wan while adding second wifi? Luci asks me that..

doddel wrote:

The way the contact is made to the ISP remains unclear to me; was assuming adsl but apparently not. More precise info needed.

I'm sorry, I missed that. No it's not DSL.
Uplink is an fiber provider. Means, my wan port usually uses dhcp. the ISP has my mac-addresses, each mac gets the same address every time connecting. I could also use a static IP, but if possible i want to keep it on dhcp, otherwise I have to change the addresses fairly often (I'm testing on this device.)

nebbia88 wrote:

Btw i cannot understand why you need relayd at all..

Yes, I tried it with bridging. but you cannot bridge dhcp from WAN to a WIFI, right? That's exactly what I try: Change no settings on the laptop, only switch the wifi networks, and I have the official address. Switch back, and I'm back in my private LAN.

Thanks for your effort guys.
Good night.

laggflor wrote:

Yes, I tried it with bridging. but you cannot bridge dhcp from WAN to a WIFI, right?

Why not? You read it somewhere?

nebbia88 wrote:
laggflor wrote:

Yes, I tried it with bridging. but you cannot bridge dhcp from WAN to a WIFI, right?

Why not? You read it somewhere?

Yea right, and it didn't work too. I didn't find the links now.

First I tried a bridge, with and without dhcp-fwd, which was pain. Relayd was easy then.

But that doesn't solve my issue, right?
I've got an idea this night:
What if I add a new interface wan2 covering the eth0 switch, then try source based routing - may this work?
I have to try later.

Thanks, best regards,
Florian

Have you tried to disable masquerade, activate dhcp client on wan interface but disable any dhcp server, have ISP interface as gateway, and let the system under test, that connects to the lan output of the OpenWrt rouiter, ask per dhcp client for an address. As the ISP is the gateway this will be anwered by the ISP.

Sry, I'm a bit busy now, I'll try on weekend. Thanks for your help so far.

The discussion might have continued from here.