How to configure two LAN ports

I have a NanoPi R2S running OK on OpenWrt and internet is connected through an LTE modem.

There are two Ethernet ports on NanoPi, but I seem to fail in taking the second one into use. Originally there was LAN (eth1) and WAN (eth0). I deleted WAN in the Interfaces page, then created LAN2 to eth0 the same way I see LAN configured on eth1. Now LAN2 works OK but LAN no more, even though I have not touched it.

What is the correct way to define two LAN ports?

What is the output of uci export network ?

Now I tried just changing WAN parameters, so LAN2 name is here WAN, but at the moment the config is like this:

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 ula_prefix 'fdb5:12df:eacd::/48'

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ifname 'eth1'

config interface 'wan'
        option type 'bridge'
        option proto 'static'
        option ip6assign '60'
        list ipaddr '192.168.2.1'
        option broadcast '192.168.2.255'
        option ifname 'eth0'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'

config interface 'LTE'
        option proto 'qmi'
        option username '*'
        option apn 'internet'
        option device '/dev/cdc-wdm0'
        option password '*'
        option auth 'both'
        option pdptype 'ipv4v6'
        option ipv6 '1'
        option peerdns '0'
        option dns '8.8.8.8'

You obviously cannot have 2 networks with the same IP. The wan is missing the netmask.

2 Likes

I do not get it. If I have a factory made four port router, all the LAN ports are e.g. 192.168.1.1. What is the difference here?

Delete wan interface, then configure accordingly:

Notice the ifname.

2 Likes

I tried editing the config directly to /etc/config/network and totally lost the access to the router, need to reinstall. :grin:

Ummm, no...see:

You likely changed the IP or protocol to something you don't recall.

1 Like

Reinstall is not a big deal. Just rewriting the MicroSD and a couple of settings.

Edit: I actually had the latest working config backed up, so it was just restore, less that ten minutes altogether.

I did the network config suggested by trendy from scratch and now both lan ports work fine. Thanks!

1 Like

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