Don't crete br-lan and lan0-lan3

This is the old 4.4 ubuntu kernel: https://github.com/BPI-SINOVOIP/BPI-R2-bsp

Hi Frank, This is for Ubuntu rite. Do we have a similar repository for OpenWRT?

No,official lede/openwrt-repo is bases on kernel 4.9 which has also dsa-ports (lanx,wan).

Maybe you can use 4.4 from ubuntu in openwrt,but i don’t know how to link it into build-process…imho 4.4 is not compilable with newer gcc-versions (4.5+)

yeah, I tried but failed to build.

For now, in my application, I am binding the interfaces(lanx) with the socket with socket option SO_BINDTODEVICE to make sure packet transfer happens though all lan ports are configured on the same subnet. Which is working fine for now:)

But, with all BPI-R2 lan ports (lan0-lan3) set on the same subnet IP, ping is failing from host though ARP entries are created. Is there a way to achieve this.

Thanks, Ashok

Why not bridging the dsa-interfaces and set ip to the bridge?

Requirement is we need 4 different address(either in same subnet or different).

As I’ve shown you earlier it is possible to have more than a single IP/subnet assigned to the same interface in linux. So I second @frank-w and my earlier posts in this topic: your best bet would be to have all dsa ports in a bridge and have all 4 IP addresses assigned to this bridge. You will need to bind your sockets to the particular source IP instead of binding to a particular device.

P.S. And regarding physical connections: it is required and sufficient to have a single cable connected to your R2 into one of lanX ports. Do not connect two or more cables to the same network unless you set up some kind of a bond - it will create a network topology loop otherwise.

your best bet would be to have all dsa ports in a bridge and have all 4 IP addresses assigned to this bridge. You will need to bind your sockets to the particular source IP instead of binding to a particular device.

Yes, I am doing in the same way socket communication also happening.

From R2 I can ping to Host with ‘ping -I’ option. But from host, I am failing to ping R2(when Ips are configured on the same subnet), though arp entries are created. Is there something else I missing here?

One more generic query, today I connected usb-ethernet card to my Ubuntu PC(eth1 is created )and assigned same subnet IP as of eth0 and when I tried to ping from other PC to my Ubuntu PC its not working. May I know why ? and any solution if there are any.

If you have multiple interfaces in same subnet your r2 don’t know to which interface your packet should be sent out.

Basicly such configuration is wrong!

You make some tricks with policy routing but you should think about your topology.

Yep, exactly this. It is possible to have setup like this to be made into a functional state but it is not a trivial task. Read about sysctl (https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt) parameters like rp_filter, arp_filter, arp_ignore and so on. Get familiar with how to use “ip ru” and “ip ro * ta X”. It won’t be a smooth ride to administer a config like this. If you’ve got an option consider changing your network topology or application architecture. It might be a good idea to use docker here or at least split your application into several threads/processes and isolate network namespace for each of them.