BPI-R2: Need help with NIC details

Hello,

I recently got rpi-b2 and was hoping to test setup as a home router. So I assigned different IP addresses to eth0 and eth1, and the ethernet cable is connected only to one physical NIC. But I’m able to ping both the IP from my LAN. How is this possible ? Also I was under the impression that ifconfig will list 5 interfaces, but I can see only two interfaces eth0 and eth1 (apart from wlan0, sit0 and tunl0).

I’m not able to find any details on internet. Can someone please explain how I can get 5 different interfaces (1 WAN and 4 LAN) working ?

Thanks

I guess you have running kernel 4.4? Try kernel 4.14…here you have interfaces wan and lan0-lan3. You will have no hdmi-output…

The explanation for this highly depends on which exact IP addresses you configured on your R2 and which configuration is present on the network interface that is connected to the R2.

In general:

  1. You are about to send a ping packet from your device to the R2. This device is going to check it’s routing table ordered by metric (lower is first) for a subnet that matches the destination. (e.g. 0.0.0.0 always matches every address and is typically known as a default gateway).
  2. If route to take is the network interface directly to the R2, the ping packet you send will arrive at the R2. For better understanding: If netfilter capabilities are enabled in the kernel the packet will follow a path like this: http://www.adminsehow.com/wp-content/uploads/2011/09/tables_traverse.jpg.
  3. On the first routing decision the R2 will check it’s routing table and concludes the IP you are looking for is configured for the device itself (see ip route list table local), thus following the “input” path.
  4. The kernel responds to the ping request, following the way back.

Then the 4 LAN ports you see are connected to a physical switch chip on the board, which in turn is connected to the CPU with 1 port. This is the ethernet device you see in kernel 4.4. As frank-w said, in kernel 4.14+ there is a driver that directly controls this switch chip and emulates 4 ethernet ports over 1 channel.

@frank-w I did apt-get update and dist-upgrade, and “uname -r” shows “4.4.70-BPI-R2-Kernel” as the version. Should I install a new image to get 4.14 kernel ?

newer kernels are not available by apt-get…you have to build it by yourself and install it manually

backup your BPI-BOOT/bananapi/bpi-r2/linux/uImage and then install to SD-Card after building

currently uploading 4.14.40 to my gdrive…

https://drive.google.com/open?id=1EGN1TvqCpDHdOAS-mjRg9ipi0kahnOUV

Thanks for the info. Will do that.

uploaded 4.14.40 for bpi-r2 to my gdrive: https://drive.google.com/open?id=1EGN1TvqCpDHdOAS-mjRg9ipi0kahnOUV

backup your uImage before unpacking the archive. there are 2 folders inside…one for boot-partition (uImage), one for root (modules). unpack then content of these 2 folders to matching partition

Thanks for the build. I extracted the files and copied BPI-ROOT/ contents to “/”, but not sure where the BPI-BOOT content should go. First I copied the content of BPI-BOOT to /boot and rebooted the device and it still booted with 4.4 kernel. Then I copied the uImage file to /usr/lib/u-boot/bananapi/bpi-r2/ and still the same result. Please let me know to upgrade correctly.

Your sdcard have 2 partitions. First is bpi-boot,second bpi-root. First should be mounted to /boot

Please post output of mount-command

$mount -t ext4
/dev/mmcblk0p2 on / type ext4 (rw,noatime,block_validity,delalloc,barrier,user_xattr,acl,stripe=1024)

Here is the full mount output :

$mount
/dev/mmcblk0p2 on / type ext4 (rw,noatime,block_validity,delalloc,barrier,user_xattr,acl,stripe=1024)
devtmpfs on /dev type devtmpfs (rw,relatime,size=996056k,nr_inodes=123501,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
mqueue on /dev/mqueue type mqueue (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=205840k,mode=700,uid=1001,gid=1001)

Your first partition is not mounted…

mount -t vfat /dev/mmcblk0p1 /mnt

And then use /mnt as bpi-boot

Make sure you have a serial-adapter on debug-uart or a 4.14-compatible network-config before reboot…else you cannot access your bpi-r2 after reboot

I added /dev/mmcblk0p1 as /boot and rebooted the device. Seems like something went as the device is not pingable anymore (I had used static IP which was working so far). I’ll try to fix this first. Thanks for the help.

Your mountpoint is not an empty folder so your boot hangs on mounting

Clear /boot on root-partition with external pc and boot r2 with that card

Hi @frank-w,

Sorry for the late reply. I emptied /boot directory and rebooted. The LEDs stopped blinking few seconds after boot, and then 5-6 seconds later LEDs become active again, and then about 5 seconds later all LEDs are off. I don't have uart cable to debug. So for now I have switched back to working image. I'll look into this after some time. Thanks for your help.

Try mounting it before reboot and look if uImage and uEnv.txt are in bananapi/bpi-r2/linux/