Bpi and gateway with wire

Hello

I think it’s besser with the last kernel :

[code]root@bpi-r2:~# uname -r
4.19.16-bpi-r2-main[/code]

I do a test with this :

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

auto eth1
iface eth1 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down


auto wan
  iface wan inet dhcp
  pre-up ip link set $IFACE address 32:D1:55:7D:03:39 up
  up /etc/init.d/firewall start

auto lan1 
allow-hotplug lan1
iface lan1 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:31 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto lan2
allow-hotplug lan2
iface lan2 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:32 up
   pre-up   ifconfig  up
   pre-down ifconfig  down


auto lan3
allow-hotplug lan3
iface lan3 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:33 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto lan0
allow-hotplug lan0
iface lan0 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:30 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto br0
iface br0 inet static
  address 192.168.2.1
  network 192.168.2.0
  bridge_ports lan0 lan1 lan2 lan3 
  bridge_fd 5
  bridge_stp no
  up /etc/init.d/firewall start

No packet lost…

I remove the mac address of lan and make a new test. The bridge don’t when I remove the mac address of the lan.

I don’t remenber who, but I have see that’s in a bridge the order of the interfaces is important : ascending order of mac address.

It’s not good, it’s only besser.

When it’s only 1 computer in lan0 or lan1 : it’s good. But, When I put 2 computers, it’s not good :frowning:

Now I have do a bridge with all lan and wan.

The bridge have a ip from my home network : 192.168.2.1

auto br0
iface br0 inet static
   address 192.168.1.10
  gateway 192.168.1.1
  bridge_ports lan0 lan1 lan2 lan3 wan
  bridge_fd 5
  bridge_stp no
  up /etc/init.d/firewall start

The BPI-R work all a switch. But, I have a big problem when I ping the BPI-R2 :

--- 192.168.1.1 ping statistics ---
106 packets transmitted, 106 received, 0% packet loss, time 597ms
rtt min/avg/max/mdev = 0.563/0.728/1.772/0.115 ms

But when I ping the box there is no problem. There is My PC <->LanX The BPI-R2 brige WAN <->2 swith <-> the box or internet

--- 192.168.1.1 ping statistics ---
106 packets transmitted, 106 received, 0% packet loss, time 597ms
rtt min/avg/max/mdev = 0.563/0.728/1.772/0.115 ms

--- www.google.fr ping statistics ---
161 packets transmitted, 161 received, 0% packet loss, time 421ms
rtt min/avg/max/mdev = 11.148/11.611/16.937/0.535 ms

I try with : My PC <->LanX The BPI-R2 brige WAN <->2 swith <-> the box. The https server works when I aks it with a public name (the call come from the box), but the same server don’t answer when I use 192.168.1.10 (the call come from lanX). I reverse the two wire, the public name don’t answer and 192.168.1.10 answer : only “wan” answer.

nb : I have use http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:debug-uart I think you must indicate how to connect with the wires. I know TX<=>RX, but not everyone knows.

R2 and usb2serial have both tx and rx…tx have to be on rx of the other (sender to receiver).

Can you ping local ip if https does not answer? Maybe it does not listen on all interfaces…netstat -tulpen shows listening ports…https should listen to 0.0.0.0:443

for the https : All the wire’s output are in the bridge. The https answer only when I ask it by the wan.

for the usb2serial : I know, but I thing it must be written on the page.

I have do a switch with all the port : ap0,wan, lan0, lan1, lan2 and lan3. It’s all in my /etc/init.d/wifi.sh.

For ip static :²

#!/bin/bash
set +e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/dev/null
NAME=wifi
DESC="Load MediaTek MT6625L firmware wifi & BT"

 if [[ ! -e /dev/wmtWifi ]];
then
  echo "wifidev does not exist...create it..."
  if [[ -x /usr/bin/wmt_loader ]];
  then
        /usr/bin/wmt_loader
        sleep 3
  else
        echo "Error, unable to find wmt_loader"
  fi

  if  [[ -c /dev/stpwmt ]];
  then
        /usr/bin/stp_uart_launcher -p /etc/firmware &
        sleep 5
  else
        echo "Error, device no created, /dev/stpwmt"
  fi
fi

if  [[ -c /dev/wmtWifi ]];
then
        if [[ -n $(ip a|grep ap0) ]];
        then
                echo "ap0 exists, reset it";
                echo 0 >/dev/wmtWifi
                sleep 5
        fi
        echo A >/dev/wmtWifi
        sleep 2
else
        echo "Error, wifi device no created, /dev/wmtWifi"
fi

ip addr show ap0
if [[ $? != "0" ]]
then
        echo "Error, device no available, ap0"
else
        echo "Done, all good, ready to lauch hostapd"
        sleep 2
        hostapd -dd /etc/hostapd/hostapd.conf &
        sleep 20


test=`ip -4 -o addr show | grep br0 | wc -l`
echo $test
while [[ $test == "0" ]]
do
        sleep 10;
        echo $test
        brctl addbr br0
        brctl addif br0 ap0 wan lan0 lan1 lan2 lan3
        ip link set dev br0 up
        ip addr add 192.168.1.10/24 dev br0
        ip route add default via 192.168.1.1
        test=`ip -4 -o addr show | grep br0 | wc -l`
done

fi

At the end I do the bridge. I wait that the bridge is up.

And the end for a up by a dhcpd server :

while [[ $test == "0" ]]
do
        sleep 10;
        echo $test
        brctl addbr br0
        brctl addif br0 ap0 wan lan0 lan1 lan2 lan3
        ip link set br0 address 32:D1:55:7D:03:39 up
        ip link set dev br0 up
        dhclient br0 
        test=`ip -4 -o addr show | grep br0 | wc -l`
done

My /etc/network/interfaces is :

source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

auto eth1
iface eth1 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

auto wan 
allow-hotplug wan
iface wan inet manual
   pre-up ip link set $IFACE address 32:D1:55:7D:03:39 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto lan1 
allow-hotplug lan1
iface lan1 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:41 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto lan2
allow-hotplug lan2
iface lan2 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:42 up
   pre-up   ifconfig  up
   pre-down ifconfig  down


auto lan3
allow-hotplug lan3
iface lan3 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:43 up
   pre-up   ifconfig  up
   pre-down ifconfig  down

auto lan0
allow-hotplug lan0
iface lan0 inet manual
  pre-up ip link set $IFACE address 32:D1:55:7D:03:40 up
   pre-up   ifconfig  up
   pre-down ifconfig  dow

Now I use the emmc.