Bpi and gateway with wire


(Troumad) #1

Now I haveall do with my bpi-r2, but not the gateway. It’s run with your debian. I have server, wifi (with hostapd…) but if I do a gateway between wan and lan[0-3], the network in lan[0-3] is not very good. I don’t understand why. I have this problem witj debian or ubuntu. I have not tested other.


Issues with NAT for LAN on 4.14.80 kernel
(Frank W.) #2

what means not very good? how do you test? how is your current config?

what have this todo with gateway?

can you please make more effort when creating threads or qustions? it’s really hard to know what do you want to do and whyts the problem


(Troumad) #3

I have say all I have do. The ping between my computer and the bpi-r2 is not good. Internet is very slow.
I do not know what to test to understand.


(Frank W.) #4

what means not good? have you packet loss or high rtt? have take a look in dmesg?

can you show us the ping? which interface do you ping how is your network-setup (client,r2,switches,connection-points)

have you tested directly connected to r2 without any other equipment (only 1 cable)?


(Troumad) #5

When I test the connection in the “lan” I have only 1 wire between the computer and the bpi-r2. I have 3 wires for the test : 1 black, 1 white and 1 yellow. I have try the yellow and the black between the bpi-r2 and internet (the network of my modem 192.168.1.XXX) : this 2 wires are good. I can do ssh with the bpi-R2 if my computer is in the network 192.168.1.XXX. I have put wan, lan0… in the network with my modem (192.168.1.XXX) : it was always good.

The bpi-r2 manages the 192.168.2.XXX network with a bridge where there is ap0. If I use the wire (black, white or yellow) to do a ssh in the network 192.168.2.XXX, and I do “dmesg”, the display blocks and starts again after a pose. I have try this with 2 PC 1 mageia 7 (testing) the other mageia 6 (stable).
If I use the wifi (hostapd in ap0) to do a ssh, and I do “dmesg”, the display is instantaneous (try only with mageia 7).
With the network 192.168.1.XXX I can do “dmesg” instantaneous.

The ping : With the wifi :

--- 192.168.2.1 ping statistics ---
825 packets transmitted, 825 received, 0% packet loss, time 825205ms
rtt min/avg/max/mdev = 1.649/2.545/209.711/7.256 ms

with the wire :

--- 192.168.2.1 ping statistics ---
236 packets transmitted, 233 received, 1% packet loss, time 240633ms
rtt min/avg/max/mdev = 0.225/0.363/0.442/0.043 ms

And the bpi-r2 ping the modem :

--- 192.168.1.1 ping statistics ---
380 packets transmitted, 380 received, 0% packet loss, time 392729ms
rtt min/avg/max/mdev = 0.533/0.691/2.119/0.136 ms

(Frank W.) #6

huge rtt…

which interfaces have you bridged?

do not bridge wifi and lan to wan


(Troumad) #7

First, I have test with a bridge without ap, after I have a bridge with ap0 I have the same problem. I can make a test without bridge…

My /etc/network/interfaces for the bridge :

auto br0
iface br0 inet static
#auto wan
#auto lan3
#iface lan3 inet static
#iface wan inet static
  address 192.168.2.1
  netmask 255.255.255.0
  bridge_ports lan1 lan2 lan3 lan0 ap0
#  bridge_ports lan0 ap0 wan lan2 lan3
  bridge_fd 5
  bridge_stp no
  pre-up /home/root/wifi/wifi.sh
  up /etc/init.d/firewall start

And this is the end of your wifi.sh

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
	    #ip addr add 192.168.3.1/24 dev ap0
	    #sleep 20
 	    #systemctl restart  isc-dhcp-server
        #sleep 20
        #hostapd -dd /etc/hostapd/hostapd.conf
fi

When I see this file, I remenber I have do test without bridge…


(Troumad) #8

The problem is only between my computer and the bridge of the bpi-r2… With a other computer : no problem.

Now, I test this network :

Internet <=>Modem<=> BPPI-R2 <=> Switch <=> 2 computer (my computer and a other)

For this test, I don’t use the wifi. If I ping the other computer with my computer :

--- 192.168.2.100 ping statistics ---
158 packets transmitted, 158 received, 0% packet loss, time 160779ms
rtt min/avg/max/mdev = 0.163/0.213/0.509/0.067 ms

If I ping the bpi-R2 with my computer :

 --- 192.168.2.1 ping statistics ---
112 packets transmitted, 103 received, 8% packet loss, time 113651ms
rtt min/avg/max/mdev = 0.349/0.466/0.559/0.054 ms

If I ping the bpi-r2 with the other computer :

 --- 192.168.2.1 ping statistics ---
435 packets transmitted, 429 received, 1% packet loss, time 444429ms
rtt min/avg/max/mdev = 0.269/0.334/0.490/0.038 ms

If I ping the modem with my computer :

 --- 192.168.1.1 ping statistics ---
115 packets transmitted, 113 received, 1% packet loss, time 115951ms
rtt min/avg/max/mdev = 0.540/0.894/1.055/0.078 ms

If I use the wire with my computer, the network is not good. If I use the bpi-r2’s WiFi the network is good.


(Frank W.) #9

please test without bridge…

why a modem between r2 and your Computers?


(Troumad) #10

Oups… A switch ( D-LINK DGS-108 ).


(Frank W.) #11

you have connected only 1 port of bpi’s lan-ports to the switch? have you tested with another port? and without the switch?


(Troumad) #12

I have tested without the switch and the same lan-port of the bpi-r2 with the same wire was not good with my computer and good with a other computer.

Since my PC had no problem communicating with ssh with the wan port of bpi-r2 via a swith, I tried to put the swith between my PC and the lan port.


(Frank W.) #13

Have you tried without bridge and different port?


(Troumad) #14

Without bridge and lan3

--- 192.168.2.1 ping statistics ---
268 packets transmitted, 262 received, 2% packet loss, time 273411ms
rtt min/avg/max/mdev = 0.244/0.394/0.496/0.053 ms

Without bridge, without wire (wire in lan3 and 192.198.2.1 in lan2 : a error), via the wifi (wifi in 192.168.3.XXX)

--- 192.168.2.1 ping statistics ---
203 packets transmitted, 203 received, 0% packet loss, time 202315ms
rtt min/avg/max/mdev = 1.575/2.021/4.997/0.513 ms

Without bridge and lan2

--- 192.168.2.1 ping statistics ---
204 packets transmitted, 195 received, 4% packet loss, time 207905ms
rtt min/avg/max/mdev = 0.295/0.407/0.485/0.046 ms

Without bridge and lan1

--- 192.168.2.1 ping statistics ---
132 packets transmitted, 124 received, 6% packet loss, time 134126ms
rtt min/avg/max/mdev = 0.293/0.421/0.525/0.046 ms

Without bridge and lan0 :

 --- 192.168.2.1 ping statistics ---
169 packets transmitted, 166 received, 1% packet loss, time 172051ms
rtt min/avg/max/mdev = 0.268/0.406/0.516/0.053 ms

Without bridge, without bind9 and lan0 :

--- 192.168.2.1 ping statistics ---
123 packets transmitted, 121 received, 1% packet loss, time 124909ms
rtt min/avg/max/mdev = 0.298/0.393/0.474/0.039 ms

(Troumad) #15

I think that’s it’s good with this config lan0 for internet ans the other for the bridge :

root@bpi-r2:~# grep -v \# /etc/network/interfaces
source-directory /etc/network/interfaces.d
auto eth1
iface eth1 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

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

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

auto br0
iface br0 inet static
  address 192.168.2.1
  netmask 255.255.255.0
  bridge_ports wan lan1 lan2 lan3
  up /etc/init.d/firewall start

Why ???


(Frank W.) #16

I don’t know if you can bridge wan to lan…but at least this line should be dropped from your config

allow-hotplug wan

(Troumad) #17

I have try the port wan and now, I try the port lan2. The netwotk work with all.

Now, I try with ap0 in the bridge… Why not. I think that’s it’s good. I did not understand why it should not work.

You have see a error :

allow-hotplug wan

I will try without this error.


(Troumad) #18

With or without the wifi in the bridge, it works better when the network does not go through the bpi-r2


(Frank W.) #19

do you still have Packetdrops?

can you test with latest 4.19 (main/gmac-tree)?

have you take a look on cpu-load, memory consumption and ethernet-interrupts (cat /proc/interrupts) while doing your speedtest?


(Troumad) #20

I have less Packetdrops. But I have.

--- www.google.fr ping statistics ---
431 packets transmitted, 424 received, 1% packet loss, time 430631ms
rtt min/avg/max/mdev = 23.661/24.219/26.133/0.346 ms

I can test your kernel, but where is it ? I don’t have many time before the 6/1/19…

I don’t do test with speedtest. I go to internet and when the bpi-r2 is between my computer and internet, I have to many problem, it’s slow.