====== Software ======
===== first steps =====
download Operation System:
[[https://drive.google.com/drive/folders/0B_YnvHgh2rwjTkdwNnE2VmFoNzg|Google Drive]] or [[https://dev.banana-pi.org.cn/Image/BPI-R2/|dev.banana-pi.org.cn]]
copy Image to SD-Card (Linux):
dd if=path/to/image.img of=/dev/sdx bs=1M
===== Debian =====
first boot (do this using [[bpi-r2:debug-uart|Debug-UART]])
**login:** root **password:** bananapi
==== System-Update & Clock-Settings ====
apt-get update && apt-get upgrade
echo "bpi-r2">/etc/hostname
dpkg-reconfigure tzdata
some changes to environment (to make persistent: echo "...">>~/.bashrc)
#fix for nano issues on debug-console
if [[ "$(tty)" =~ "ttyS" ]]; then export TERM=vt100;fi
#prompt with time
export PS1='[\A] \u@\h:\W# '
#easier access to GPIO by $GPIO
export GPIO=/sys/devices/platform/1000b000.pinctrl/mt_gpio
==== Network-Configuration ====
[[.:network:|Network-configuration]]
=== temporary ===
#4.4.70:
ifconfig eth0 192.168.0.10/24
route add default gw 192.168.0.5
echo "nameserver 192.168.0.5" > /etc/resolv.conf
#4.14:
#ifconfig eth0 up
ip link set eth0 up
#ifconfig lan0 192.168.0.10/24
ip addr add 192.168.0.10/24 dev lan0
#ifconfig lan0 up
ip link set lan0 up
#route add default gw 192.168.0.5
ip route add 0.0.0.0/0 via 192.168.0.5
echo "nameserver 192.168.0.5" > /etc/resolv.conf
=== fixed (also after reboot) ===
4.4.70:
nano /etc/network/interfaces
auto eth0
iface eth0 inet static
hwaddress ether 08:00:00:00:00:01
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.5
auto eth1
iface eth1 inet static
4.14:
auto eth0
iface eth0 inet manual
pre-up ip link set $IFACE up
post-down ip link set $IFACE down
auto lan0
iface lan0 inet static
hwaddress ether 08:00:00:00:00:00 # if you want to set MAC manually
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.5
pre-up ip link set $IFACE up
post-down ip link set $IFACE down
auto lan1
iface lan1 inet static
hwaddress ether 08:00:00:00:00:01 # if you want to set MAC manually
address 192.168.1.10
netmask 255.255.255.0
pre-up ip link set $IFACE up
post-down ip link set $IFACE down
auto lan2
iface lan2 inet static
hwaddress ether 08:00:00:00:00:02 # if you want to set MAC manually
#...
auto lan3
iface lan3 inet static
hwaddress ether 08:00:00:00:00:03 # if you want to set MAC manually
#...
auto wan
iface wan inet static
hwaddress ether 09:00:00:00:00:01 # if you want to set MAC manually
#...
in debian 9 hwaddress does not work, here you can set the MAC this way:
iface lan0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.5
# pre-up ip link set $IFACE up
pre-up ip link set $IFACE address 02:01:02:03:04:08 up
post-down ip link set $IFACE down
UDEV-way from [[http://forum.banana-pi.org/t/bpi-r2-ethernet-mac-address/4361/23|here]]
$ cat /etc/udev/rules.d/00-static-mac-address.rules
ACTION=="add", SUBSYSTEM=="net", KERNELS=="1b100000.ethernet", RUN+="/sbin/ip link set dev %k address ae:fc:de:ad:be:ef"
== DHCP ==
allow-hotplug lan3
iface lan3 inet dhcp
== bridge (4.14) ==
FIXME untested :!:
apt-get install bridge-utils
brctl addbr br0
brctl addif br0 lan1 lan2 lan3 #bridging lan1-lan3 (keep lan0 separately)
root@bpi-r2:~# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.6acba7512bc1 no lan1
lan2
lan3
/etc/metwork/interfaces:
iface br0 inet static
address 192.168.40.1
netmask 255.255.255.0
bridge_ports lan1 lan2
bridge_fd 5
bridge_stp no
== vlan ==
4.14:
/etc/metwork/interfaces:
auto lan3
iface lan3 inet manual
auto lan3.60
iface lan3.60 inet static
address 192.168.60.10
netmask 255.255.255.0
# gateway 192.168.0.5
pre-up ip link set $IFACE address 02:01:02:03:04:03 up #setting mac does not work currently