How to set multiple network on OpenWrt 18.06.2

If you can separate the networks physically using different switches, then create another VLAN.
Otherwise, you need to configure static leases for all the clients.

Hi vgatera..I connect Lan on port 1 on switch with 1.0 network, lan on port 4 to another router with 2.0 network. but still cant ping both of them..only 1 ip 1.113 or 3.113 at the same time.
Here is config


root@OpenWrt:~# cat /etc/config/network

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.2.113'
        option ifname 'eth0.1'

config interface 'lan2'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.113'
        option netmask '255.255.255.0'
        option ifname 'eth0.2'

config interface 'wan'
        option proto 'static'
        option ipaddr '192.168.1.2'
        option netmask '255.255.255.0'
        option gateway '192.168.1.201'
        option dns '8.8.8.8'
        option ifname 'eth0.3'

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

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

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

and firewall

 cat /etc/config/firewall

config defaults
        option syn_flood '1'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option network 'lan'
config zone
        option name 'lan2'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option network 'lan3'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
swconfig list; swconfig dev switch0 show; swconfig dev switch0 help

Hi vgaetera..here it is

swconfig list
Found: switch0 - ag71xx-mdio.0

swconfig dev "$(swconfig list | cut -d " " -f 2)" show
Global attributes:
        enable_vlan: 1
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
        arl_age_time: 300
        arl_table: address resolution table
Port 0: MAC 64:66:b3:6f:87:ea
Port 2: MAC 9e:41:7c:43:16:78
Port 2: MAC c4:6e:1f:40:c7:e4
Port 2: MAC 00:22:c0:3a:18:d1
Port 2: MAC 00:26:82:d0:55:81
Port 2: MAC 5c:9a:d8:68:e0:91
Port 2: MAC c0:4a:00:49:f7:fe
Port 5: MAC 00:26:82:d0:55:81
Port 5: MAC 5c:9a:d8:68:e0:91
Port 5: MAC 00:22:c0:3a:18:d1
Port 5: MAC c4:6e:1f:40:c7:e4

        igmp_snooping: 0
        igmp_v3: 0
Port 0:
        mib: MIB counters
RxBroad     : 55
RxPause     : 0
RxMulti     : 42
RxFcsErr    : 0
RxAlignErr  : 0
RxRunt      : 0
RxFragment  : 0
Rx64Byte    : 71
Rx128Byte   : 345
Rx256Byte   : 174
Rx512Byte   : 5
Rx1024Byte  : 10
Rx1518Byte  : 0
RxMaxByte   : 0
RxTooLong   : 0
RxGoodByte  : 75128 (73.3 KiB)
RxBadByte   : 0
RxOverFlow  : 0
Filtered    : 82
TxBroad     : 291
TxPause     : 0
TxMulti     : 55
TxUnderRun  : 0
Tx64Byte    : 0
Tx128Byte   : 702
Tx256Byte   : 50
Tx512Byte   : 4
Tx1024Byte  : 1
Tx1518Byte  : 0
TxMaxByte   : 0
TxOverSize  : 0
TxByte      : 68971 (67.3 KiB)
TxCollision : 0
TxAbortCol  : 0
TxMultiCol  : 0
TxSingleCol : 0
TxExcDefer  : 0
TxDefer     : 0
TxLateCol   : 0

        enable_eee: ???
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        mib: No MIB data
        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 0
        link: port:1 link:down
Port 2:
        mib: MIB counters
RxBroad     : 195
RxPause     : 0
RxMulti     : 43
RxFcsErr    : 0
RxAlignErr  : 0
RxRunt      : 0
RxFragment  : 0
Rx64Byte    : 307
Rx128Byte   : 237
Rx256Byte   : 33
Rx512Byte   : 3
Rx1024Byte  : 1
Rx1518Byte  : 0
RxMaxByte   : 0
RxTooLong   : 0
RxGoodByte  : 49253 (48.0 KiB)
RxBadByte   : 0
RxOverFlow  : 0
Filtered    : 0
TxBroad     : 0
TxPause     : 0
TxMulti     : 14
TxUnderRun  : 0
Tx64Byte    : 12
Tx128Byte   : 277
Tx256Byte   : 171
Tx512Byte   : 5
Tx1024Byte  : 11
Tx1518Byte  : 0
TxMaxByte   : 0
TxOverSize  : 0
TxByte      : 63282 (61.7 KiB)
TxCollision : 0
TxAbortCol  : 0
TxMultiCol  : 0
TxSingleCol : 0
TxExcDefer  : 0
TxDefer     : 0
TxLateCol   : 0

        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 1
        link: port:2 link:up speed:1000baseT full-duplex txflow rxflow auto
Port 3:
        mib: No MIB data
        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 1
        link: port:3 link:down
Port 4:
        mib: No MIB data
        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 2
        link: port:4 link:down
Port 5:
        mib: MIB counters
RxBroad     : 96
RxPause     : 0
RxMulti     : 12
RxFcsErr    : 0
RxAlignErr  : 0
RxRunt      : 0
RxFragment  : 0
Rx64Byte    : 78
Rx128Byte   : 87
Rx256Byte   : 17
Rx512Byte   : 1
Rx1024Byte  : 0
Rx1518Byte  : 0
RxMaxByte   : 0
RxTooLong   : 0
RxGoodByte  : 17154 (16.7 KiB)
RxBadByte   : 0
RxOverFlow  : 0
Filtered    : 0
TxBroad     : 1
TxPause     : 0
TxMulti     : 0
TxUnderRun  : 0
Tx64Byte    : 5
Tx128Byte   : 53
Tx256Byte   : 4
Tx512Byte   : 0
Tx1024Byte  : 0
Tx1518Byte  : 0
TxMaxByte   : 0
TxOverSize  : 0
TxByte      : 6088 (5.9 KiB)
TxCollision : 0
TxAbortCol  : 0
TxMultiCol  : 0
TxSingleCol : 0
TxExcDefer  : 0
TxDefer     : 0
TxLateCol   : 0

        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 2
        link: port:5 link:up speed:1000baseT full-duplex txflow rxflow auto
Port 6:
        mib: No MIB data
        enable_eee: ???
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 0
        link: port:6 link:down
VLAN 1:
        vid: 1
        ports: 0t 2 3
VLAN 2:
        vid: 3
        ports: 0t 4 5

Why vid=3, shouldn't it be vid=2?

Yes, vgaetera writes correct remark. To sum up,
by default your switch has 2 vlans: for lan and wan. You should add another vlan for new lan. So you should configure 3 vlans (in your config only 2 present). Don't mess vlan and vid, leave them the same.

1 Like

sorry ..the router is gone...i will post back if I have another (decent) router.. thanks

1 Like