How to set openwrt router as switch and a router in same time?

Hi, everyone, I have been confused by one kind of openwrt setting for a long time, and got no reslution with the keyword virtual ethernet interface in openwrt by google.com, so I have to come here to ask for help.

Here is my first demand, I want to achieve one network topology as the following picture.

The rest in the reply.

And the second is very similar.

Originally, I want to create a virtual ethernet named veth0 and bridge it to wan, then use the veth0 as wan device. but it says DEVICE_CLAIM_FAILED

This trobule me for almost one year, :rofl:,

Welcome to the community!

  • What device and version of OpenWrt?
    ubus call system board
  • What's the config?
    cat /etc/config/wireless

Why were you searching for this term?

Why?

If you provide more information, we may be able to offer more substantive replies.

what you want is a new (third) firewall zone, where you put your pc1 from scenario 1 and all pcs from scenario 2. And that 3rd zone then gets its one forward and routing rules towards the WAN zone.

Look for guest network in wiki and forum. That is the type of config you want.

2 Likes

Thank you lleachii, for replying. I am sorry for missing informations.

The router2 is a xiaomi 3 pro, openwrt is in version 22.03. ubus call sytem board return

{
        "kernel": "5.10.161",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "Xiaomi Mi Router 3 Pro",
        "board_name": "xiaomi,mi-router-3-pro",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "22.03.3",
                "revision": "r20028-43d71ad93e",
                "target": "ramips/mt7621",
                "description": "OpenWrt 22.03.3 r20028-43d71ad93e"
        }
}

wireless config is just as default now, cat /etc/config/wireless return

config wifi-device 'radio0'
        option type 'mac80211'
        option path '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0'
        option channel '1'
        option band '2g'
        option htmode 'HT20'
        option disabled '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

config wifi-device 'radio1'
        option type 'mac80211'
        option path '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0'
        option channel '36'
        option band '5g'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

This operation just came to my mind, I cannot explain it specifically.

Blockquote

My apologies, I meant to post:

cat /etc/config/network

?

/etc/config/network contains

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

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'fd19:28d6:e874::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

cat /etc/config/network

Sorry for unclearance. you have asked why I do

Originally, I want to create a virtual ethernet named veth0 and bridge it to wan, then use the veth0 as wan device.

I dont know how to explain why. It is just a try based on my knowledge. :rofl:

Hi Pico, thank you very much for replying. I will search for it, and have a try.

Starting from a default configuration, create a WAN bridge, then move PORT2 out of the LAN bridge and into the WAN bridge; then, configure the wireless interface as if it was a guest network.

This does not make sense... second router has LAN as 192.168.0.1, but there is no interface with that configuration.

1 Like

I sunddenly know how to deal with it.

Just bridge port1 and port2 as br-wan. And create an interface call wan with dhcp ignored on br-wan, then the device of will got one ip from upstream router.

Both scenarios can be achieve in a similiar way.

In your second scenario you can perhaps also setup as a Dumb AP and have a guest wifi on its own subnet

Oh, yes. I will setup one.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.