OpenWrt Forum Archive

Topic: Merge/bridge WAN with LAN wr841nd

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

What I need is that all ports LAN/WAN become only LAN, so my main router can connect to any port and have internet.

I've tried bridging them:

option ifname   'eth0 eth1'   # Bridges lan and wan

But with this method I only receive dhcpIP/internet access, connecting the main router through the WAN port and over wireless, but the other 4 lan ports won't get IP/internet.

On the wiki says that my type of router should use

option ifname   'eth0.1 eth1'  # Bridges vlan 1 and wan

but I don't see the VLAN interface anywhere and because I'm building the firmware I don't want to semi-brick the router and lose access.

How should I do this? Router is TPLINK-WR841ND
Thanks

(Last edited by Rustic on 16 May 2017, 23:12)

If your bridge eth0 and eth1 together, then connect the main router to any of the ethernet ports, then your router and any device that connects to it should get an IP address and an internet connection from the main router. If that does not work, please post the complete config files here.

eduperez wrote:

If that does not work, please post the complete config files here.

dhcp

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option ignore '1'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

firewall

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT
# Uncomment this line to disable ipv6 rules
        option disable_ipv6     1

config zone
        option name             lan
        list   network          'lan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT
        option masq             1
        option mtu_fix          1
        option ignore           1

config forwarding
        option src              lan
        option dest             wan

network

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

config interface 'lan'
    option ifname 'eth0 eth1'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.20'
    option gateway '192.168.1.1'   #mainrouter's IP
    option netmask '255.255.255.0'

wireless

config wifi-iface
    option device   radio$devidx
    option network  lan
    option mode     ap
        option ssid     Openwrt
    option encryption   psk2
    option key      87654321

Thanks

(Last edited by Rustic on 17 May 2017, 21:48)

Everything looks correct to me, it should work as described... you could delete the WAN zone and LAN to WAN forwarding in the firewall, as you no longer have a WAN interface, but leaving them should make no harm. Are you sure the main router has an active DHCP server?

eduperez wrote:

Are you sure the main router has an active DHCP server?

I'm positive, I get an IP with any other router(dhcp disabled)/switch
http://imgur.com/YNfbVM6 - main mikrotik router
I did install relayd in menuconfig, could that be a problem?

(Last edited by Rustic on 17 May 2017, 23:24)

You do not need to run relayd if you have bridged the interfaces. Next thing I would check is wether the bridge is really working: execute "ifconfig" and "brctl show", and post the output here, please.

eduperez wrote:

You do not need to run relayd if you have bridged the interfaces. Next thing I would check is wether the bridge is really working: execute "ifconfig" and "brctl show", and post the output here, please.

ifconfig

br-lan    Link encap:Ethernet  HWaddr E8:DE:27:58:80:62
          inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::eade:27ff:fe58:8062/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:450 errors:0 dropped:0 overruns:0 frame:0
          TX packets:329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:46057 (44.9 KiB)  TX bytes:83686 (81.7 KiB)

eth0      Link encap:Ethernet  HWaddr E8:DE:27:58:80:62
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1275 errors:0 dropped:4 overruns:0 frame:0
          TX packets:1682 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:160570 (156.8 KiB)  TX bytes:1770239 (1.6 MiB)
          Interrupt:5

eth1      Link encap:Ethernet  HWaddr E8:DE:27:58:80:63
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1361 errors:0 dropped:2 overruns:0 frame:0
          TX packets:953 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1687601 (1.6 MiB)  TX bytes:115105 (112.4 KiB)
          Interrupt:4

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr E8:DE:27:58:80:62
          inet6 addr: fe80::eade:27ff:fe58:8062/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:17419 (17.0 KiB)

brctl show

bridge name     bridge id               STP enabled     interfaces
br-lan          7fff.e8de27588062            no               eth0
                                                              eth1
                                                              wlan0

(Last edited by Rustic on 19 May 2017, 00:15)

Again, everything looks as expected... I'm out of ideas here...

Thanks, damm.
Would you recommend to try Lede?
I will try other router versions, since Ive only tried with v9 Tplink.

(Last edited by Rustic on 19 May 2017, 08:44)

What happens if you disable the static IP configuration of the LAN-WAN bridge, and let it obtain all its settings through DHCP from the main router? I know it's a bit far-fetched, but perhaps there's an address conflict with the static 20 address and the DHCP lease range of the main router?

Another thing which caught my eye is that the 'wlan0' interface in your 'ifconfig' output has an IPv6 address, while the 'eth0' and 'eth1' participants of the bridge do not have it. Logic suggests that only the bridge interface should have addresses. Please note that I am not privy to all the secrets of 'ipconfig', so the IPv6 address show for 'wlan0' might simply be a side-effect of the way a wireless interface works in Linux smile

One more thing that I might try is switching off one of the interfaces in the three-way bridge. I know it shouldn't matter how many interfaces there are in a bridge, but if your main router is connected to OpenWRT over both the LAN or WAN port, and the WLAN connection at the same time, then it may cause curious routing hiccups. Especially considering the IPv6 address of the 'wlan0'.

Could you give us the switch configuration? That's the part you skipped from /etc/config/network.

You can either disable the switches vlan ("option enable_vlan 0" in the "config switch" section) and bridge eth0 and eth1, or you enable vlans ("option enable_vlan 1"), create a VLAN Id for LAN and bridge eth0.1 and eth1.

If you don't "see" the switch config in LuCI, I guess you don't have a switch config at all (which might let your switch in any unknown default state) and just configured the VLAN ID on your interface. If that's the case, just add a proper switch config.

According to documentation, on v9 WAN is eth1 and switch is eth0. On v8 that might be swapped.

Regards,
Stephan.

Golialive - That did the trick, I enabled VLAN and now it works!
Thanks alot!

The discussion might have continued from here.