Bridge from WAN to LAN

Hi,

I wanted to enable bridge mode i.e my router is connected to WAN(eth0) which will be having the public IP with three VLANS configured. What actually is required is the same VLAN should be assigned to the LAN ports as will . from WAN port it must be bridged to the LAN port. So the device connected in the LAN should be able to dhcp and get the public IP not the local IP address.

Also am not aware on how to configure the VLAN in /etc/config/network need to create VLAN ID for the eth0 interface.

Please help me on this

Thank you,
Deepanraj.A

Your whole explanation is kind of a mess and I do not understand what you're attempting to do. Here, for example, you're talking about LAN: do you actually mean the LAN-network, or do you mean one of the physical LAN-ports? They are two different things and you need to be more precise about your setup and what you want, if you want people to be able to help you.

First thing is i wanted to configure vlan Id. So how do i update in /etc/config/network/

Second point is my want interface i.e eth0 has vlan id 41 so i wanted to bridge my eth0.41 to my lan interface. So the device which is physically connected to my lan interface will be able to get IP address via dhcp. The IP address assigned to my device should not be in the series to that of the ip address assigned in the eth0.41

You want the entire LAN-interface bridged with WAN, or just one of the ports?

entire wan interface bridged with lan

That sounds like a bad idea, but if that's what you really want, then you just simply disable DHCP-server on LAN, delete the WAN-interface and then add eth0.41 to the LAN-bridge. Then they're all bridged together.

How to create vlan Id for each interface in /etc/config/network file

You don't create VLANs out of interfaces, you create them out of ports. Also, it depends on how many CPUs, ports and switches your device has. It'd be far easier, if you just installed the web-GUI called Luci and used that.

Anyway, for e.g. a device with a single CPU-core and a single switch, you need something akin to the following:


config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 2 3 4 5'
        option vid '1'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0t 2t 3t 4t 5t'
        option vid '3'

The first part enables VLAN-functionality, then the latter ones each define a VLAN ID, ie. VLAN 1 and VLAN 2 in this case. Port 0 is the CPU and then 2, 3, 4 and 5 are the physical Ethernet-ports. Ports with the letter 't' are tagged, the ports without it are untagged.

In case i wanted to create vlan like eth0.41 how do i configure that

That depends on how many ports you have, which ports you want to be part of the VLAN and if the traffic on those ports should be tagged or not. If the traffic coming into the ports is tagged, then the ports should be tagged, and if the traffic isn't tagged, then they should be untagged. If they're untagged, then you need to remove the same untagged ports from any other VLANs.