How do I set up port@1 to be a WAN?

I am using MT7621 CPU, datasheet description has port@0-port@4, port0(eth1) is WAN , port@1-port@4(eth0) is LAN, how to set port@1 to WAN in /etc/board.d/02_network?

I found reference:

How to enable luci Page Network > Switch?

Are you building from source or are you trying to configure based on the standard OpenWrt images?

Yes, I use standard openwrt 22.03

This is about to become EOL, so you should consider upgrading to 23.05.

Assigning port 1 as a wan should be trivially simple. Are you looking to make 2 wans, swap a wan and lan port, or do something else?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network

It is possible to make 2 WANs or swap a WAN and lan port, how do they do it?

{
        "kernel": "5.10.176",
        "hostname": "board-test_868B",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "board-test",
        "board_name": "board-test",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "22.03.4",
                "revision": "20240319-1601-g4c37c26-dirty",
                "target": "ramips/mt7621",
                "description": "OpenWrt 22.03.4 20240319-1601-g4c37c26-dirty"
        }
}

The network context as follow:

#cat /etc/config/network

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 default_ps '0'
        option ula_prefix 'fddc:7664:2774::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0'
        option proto 'static'
        option ipaddr '192.168.77.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device 'lan_dev'
        option name 'eth0'
        option macaddr 'a2:60:40:81:c3:e4'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'
        option metric '1'

config device 'wan_dev'
        option name 'eth1'
        option macaddr 'ce:23:ac:5b:b5:b6'

config interface 'wan6'
        option ifname 'eth1'
        option proto 'dhcpv6'

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

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

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 5'

config interface 'wan2'
        option proto 'dhcp'
        option metric '20'

config interface 'wan1'
        option proto 'dhcp'
        option ifname 'eth2'
        option metric '10'

Your configuration appears to be invalid...

For 22.03, the ifname and bridge in an interface definition is not proper syntax.

Please start by upgrading to 23.05 (since 22.03 will be EOL and unsupported after April 2024 -- that's next month). When you run the upgrade, do not keep settings.

Then post the same information as requested earlier and we'll go from there.

1 Like

It's solved. Thank you.

Reference: [Solved] How to swap LAN switch to WAN - #4 by psherman

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