OpenWrt Forum Archive

Topic: Bridge on wan

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

Hi everyone , i am wondering if it is possible to do this :

My router have 1 wan port and 4 lan ports .

I want that the router act as a router delivering lan ip addresses between wan -> lan ports (2,3,4)

and want a transparent bridge between port wan & port 1 .

Is this even possible ?

Yes, of course it is possible: you just need to bridge both interfaces together, and adapt the configuration (IP address, DHCP, ...). Some routers have separated WAN and LAN interfaces on the CPU, some have just one interface, and separate them in the switch using VLANs; in the latter case, you could even bridge them together in the switch.

Yes, this is possible. I've configured this on several routers. Background: my cable internet provider's TV box needs a specific IP address (non-local) in a range that gets assigned from the WAN.

In the most recent firmware, it requests two IP address (via DHCP) with 2 different MAC addresses, but I haven't figured out yet how to accomplish a separation into two different VLANs based on MAC for the LAN1 port (if such a thing is possible).

If your router is a typical GbE model with everything going through the switch, you can do that directly with switch configuration.   

If it has a dedicated CPU port that is directly wired to the WAN port on the back, bypassing the switch hardware, it is more complicated.  You would need to set up a bridge in the kernel and use VLANs on the other eth port and switch to bring the WAN bridge out.

(Last edited by mk24 on 5 Dec 2017, 16:01)

Here it is my current vlan config :
https://s17.postimg.org/tjtj5nn1r/Image5.jpg

Like bdeblier said , the wan port will request 2 dhcp leases , 1 for the port i want (1) and the other to the router inside that will provide internet thru the current vlan config in image to ports 2,3 & 4 .

If it is possible then how can i do it step by step using current image that i uploaded .

Thank you

The mapping of physical ports to the switch logical ports varies by router model and isn't always correct in Luci.  Consult the wiki page for your model.

You can also find out which port is which by plugging and unplugging a cable and watching the connect status icons. 

Evidently port 6 is connected to the CPU so eth0.1 is LAN and eth0.2 is WAN.  Ethernet ports which are "untagged" in VLAN 1 (and "off" in 2) are in the LAN.  Port(s) which are "untagged" in VLAN 2 (and "off" in 1) are the WAN.

What you posted doesn't make sense because there are only 4 ports active instead of 5.

(Last edited by mk24 on 6 Dec 2017, 02:48)

Port 7 i have no clew what it is , but port 6 could be considered the bridge between the 2 vlans , i think .

My current network config on network file is :

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'ffff:ffff:ffff::/48'

config interface 'lan'
        option ifname 'eth0.1'
        option force_link '1'
        option macaddr 'xx:xx:xx:xx:xx:xx'
        option type 'bridge'
        option proto 'static'
        option ip6assign '60'
        option ipaddr '1.1.1.1'
        option netmask '255.255.0.0'

config interface 'wan'
        option ifname 'eth0.2'
        option force_link '1'
        option proto 'dhcp'
        option delegate '0'
        option peerdns '0'
        option dns '208.67.220.220 208.67.222.222'
        option macaddr 'xx:xx:xx:xx:xx:xx'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
        option enable_vlan4k '1'
        option max_length '3'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 2 3 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 6t'

On this previous post Port 1 is untagged , wich means that is connected to vlan and it is providing a lan dhcp release .

But if i turn port 1 off like in the image above , i get this difference on the config :

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '2 3 4 6t'

Now what i need is that port 1 have its own macaddress and create a transparent bridge to wan .

(Last edited by pedropt on 6 Dec 2017, 10:45)

pedropt wrote:
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 6t'

Now what i need is that port 1 have its own macaddress and create a transparent bridge to wan .

Since all your ports seem to be on the same switch, all you need is to also change the section above to:

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 1 6t'

I.e. put your port 1 in the same vlan as port 0 (your current WAN port).

Correction: that won't give it its own mac address. But if you bridge two ports (or interfaces), only the bridge device will have a mac address anyway.

(Last edited by bdeblier on 7 Dec 2017, 14:02)

A switch doesn't have a MAC address.  It passes packets along without changing their MAC address.

I assume you're doing something like connecting an IPTV box to a modem and also having your router get Internet access from the same modem.  In some cases you'll also have to configure the switch for specific VLANs that the box and modem are using.

Thanks bdeblier , that is exactly correct .
The solution is to select the port you ant to bridge on the same vlan as wan port .

http://i68.tinypic.com/2uo6v07.jpg

thank you for your help

By the way , Port7 i believe that is the wifi network .

0 = wan
1= lan
2= lan
3= lan
4= lan
cpu=cpu
6=Vlan
7=Wifi

this is a Dlink DIR 645

(Last edited by pedropt on 9 Dec 2017, 00:48)

The discussion might have continued from here.