OpenWrt Forum Archive

Topic: Make OpenWrt Work Like Switch

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

Can I configure OpenWrt to make hosts use the DHCP server on the network the router is plugged in to, rather than dnsmasq?  Also is there a way to make multicast work trans-router?  I basically want the router to work like a switch, including the wireless.  I think for the wired to do what I want, I'd just have to make all the switch ports one big VLAN, but I have no clue about the wireless.  How can I do this?

Wireless is normally bridged to br-lan, which contains all lan ports and the wireless device. If you move the wan port to the lan-vlan too (/etc/config/network, config switch eth0), you will have what you want.
To disable the dhcp server on the router, run "/etc/init.d/dnsmasq disable".

Somehow the DHCP seems not to get through.  I end up with no IP address on anything.

Sounds like it could be a network configuration issue. Do you have an IP address in your private network assigned to the "lan" (or appropriate interface) so that your switch knows to send packets its way?

If that doesn't do it, it would be helpful to see your /etc/config/network (or, if on a recent build, the output of uci show network).

Here is what I tried:

#### VLAN configuration 
config switch eth0
    option vlan0    "0 1 2 3 4 5*"


#### Loopback configuration
config interface loopback
    option ifname    "lo"
    option proto    static
    option ipaddr    127.0.0.1
    option netmask    255.0.0.0


#### LAN configuration
config interface lan
    option type     bridge
    option ifname    "eth0.0"
    option proto    dhcp

Unfortunately nothing got DHCP-ed; so, nothing worked.

I think the issue may be with your LAN configuration. I can see why you would expect the "option dhcp" directive to fill in the blanks for you, but I'm guessing that it isn't, for some reason. 'ifconfig -a' and 'netstat -rn' should let you know what OpenWrt thinks about its interfaces and routes.

I run with "static" on the "config interface lan" and supply ipaddr, netmask, gateway, and DNS server in that section. You might want to give that a shot.


#### VLAN configuration 
config switch eth0
    option vlan0    "0 1 2 3 5*"    # Stock
    option vlan1    "4 5"           # Stock, and unused


#### Loopback configuration        # No need to mess with this
config interface loopback
    option ifname    "lo"
    option proto    static
    option ipaddr    127.0.0.1
    option netmask    255.0.0.0


#### LAN configuration
config interface lan
    option type     bridge
    option ifname    "eth0.0"
    option proto    static
    option ipaddr    192.168.6.253    # IP address for access
    option netmask    255.255.255.0   # and netmask
    option gateway    192.168.6.1     # So OpenWrt can get to rest of world
    option dns    192.168.6.1    # and OpenWrt can have DNS services


#### WAN configuration            # Stock, and unused
config interface    wan
    option ifname    "eth0.1"
    option proto    none

The discussion might have continued from here.