Skip to content

Instantly share code, notes, and snippets.

@livekn
Last active July 22, 2020 17:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save livekn/46e4b08e4a1f7b25ed8c to your computer and use it in GitHub Desktop.
Save livekn/46e4b08e4a1f7b25ed8c to your computer and use it in GitHub Desktop.
Banana Pi R1 Switch setting
sudo apt-get install vlan
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0.101
iface eth0.101 inet dhcp
auto eth0.102
iface eth0.102 inet static
address 192.168.1.1
netmask 255.255.255.0
#!/bin/sh
#---------------------------#
# BPI-R1 VLAN configuration #
#---------------------------#
#
# This will create the following ethernet ports:
# - eth0.101 = WAN (single port)
# - eth0.102 = LAN (4 port switch)
#
# You have to adjust your /etc/network/interfaces
#
# Comment out the next line to enable the VLAN configuration:
#exit 0
ifconfig eth0 up
# The swconfig port number are:
# |2|1|0|4| |3|
# (looking at front of ports)
swconfig dev eth0 set reset 1
swconfig dev eth0 set enable_vlan 1
swconfig dev eth0 vlan 101 set ports '3 8t'
swconfig dev eth0 vlan 102 set ports '4 0 1 2 8t'
swconfig dev eth0 set apply 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment