Bananian

Bananian on BPI-Router - Discussion

99 30753
mattrix  
Edited by mattrix at Thu Dec 18, 2014 00:13

Working good

quick example network file

/etc/network/interfaces

  1. [code]
  2. auto lo
  3. iface lo inet loopback

  4. auto eth0.101
  5. iface eth0.101 inet dhcp
  6.     pre-up swconfig dev eth0 set reset 1
  7.     pre-up swconfig dev eth0 set enable_vlan 1
  8.     pre-up swconfig dev eth0 vlan 101 set ports '3 8t'
  9.     pre-up swconfig dev eth0 set apply 1

  10. auto eth0.102
  11. iface eth0.102 inet manual
  12.     pre-up swconfig dev eth0 vlan 102 set ports '0 1 2 4 8t'
  13.     pre-up swconfig dev eth0 set apply 1
Copy the Code
This will set the right-most WAN port as DHCP "input" and the other 4 ports would be ready for output (DHCP server etc)

Having vlan installed actually caused some errors to show, so removed this and was better
Also removed the "vlan" files in /etc/network/if-pre-up.d /if-post-down as this conflicted with manually setting up vlan in the interfaces files.

Don't forget to enable vlan in the kernel with
  1. echo "8021q" >> /etc/modules
Copy the Code
Will upload a whole Bananian image for the Router shortly

mattrix  
Another way to configure is

Add a new file
/etc/network/if-pre-up.d/swconfig
  1. #!/bin/sh
  2. ifconfig eth0 up
  3. swconfig dev eth0 set reset 1
  4. swconfig dev eth0 set enable_vlan 1
  5. swconfig dev eth0 vlan 101 set ports '3 8t'
  6. swconfig dev eth0 vlan 102 set ports '0 1 2 4 8t'
  7. swconfig dev eth0 set apply 1
Copy the Code
Make it executable.
Then change the network/interfaces simply to
  1. auto lo
  2. iface lo inet loopback

  3. auto eth0.101
  4. iface eth0.101 inet dhcp

  5. auto eth0.102
  6. iface eth0.102 inet manual
Copy the Code

mattrix  
Release thread for the image now up here:

[Release] Bananian 14.11 for BPI-R1 (Router)
http://forum.lemaker.org/forum.p ... 32&fromuid=2122

mattrix  
Edited by mattrix at Thu Dec 18, 2014 16:28

Mr Bananian,

Would a pull request to your github be the way to go?

We need to decide on what to put in, and what to have enabled be default.
Obviously you want 1x image to suit all boards?

I propose:

Bring in the kernel code for the swconfig and switch..
Bring in the AXA USB3.0 Ethernet adapter code maybe? - these are nice and actually get better speed than the USB2.0 adapters I have found even though using USB2.0 ports?

Have both enabled in the kernel (can't seem them affecting the other boards)

Add the /usr/sbin/swconfig utility  - this will just not find a switch on the other boards if people try to use it.

I think still keep the default /etc/network/interfaces file (eth0 dhcp)

This will work with the router as well as it will just set all the ports to eth0 and therefore router uses will be able to get inital SSH access to then change the interfaces file to use vlan etc.

Do we enable vlan module by default? I think maybe not as it's only useful for the Router and it is easy to turn on

On your site, maybe you could just have a little how-to for the BPI and some example interfaces and the example /etc/network/if-pre-up.d/swconfig files.
and how to turn on vlan  module
  1. echo "8021q" >> /etc/modules
Copy the Code

Maby let Vlan on most people buy it because of the router function , yes they use it for more but sureley also router ;)

mattrix  
Yes, without the VLAN module you get a lot of errors etc, and it kills the network.
So, maybe have it enabled by default for all boards just for the sake of keeping the router happy?

mattrix  
here's another nice example swconfig setting up each port to have it's own vlan
  1. #!/bin/sh
  2. ifconfig eth0 up
  3. swconfig dev eth0 set reset 1
  4. swconfig dev eth0 set enable_vlan 1
  5. swconfig dev eth0 vlan 101 set ports '3 8t'
  6. swconfig dev eth0 vlan 102 set ports '4 8t'
  7. swconfig dev eth0 vlan 103 set ports '0 8t'
  8. swconfig dev eth0 vlan 104 set ports '1 8t'
  9. swconfig dev eth0 vlan 105 set ports '2 8t'
  10. swconfig dev eth0 set apply 1
Copy the Code
this will give you the VLANS

|105|104|103|102|  |101|

Edited by notthematrix at Fri Dec 19, 2014 18:25

Add in the swconfig file one per vlan.
ifconfig eth0.102 hw ether 02:94:0a:xx:xx:xx
is nice handy to add to give all the vlans its own mac address ;)
This is needed if you want to run a dhcp-server without problems.
If people want it I can share the config.

mattrix  
Can you set the mac in the interfaces file? Seems to me it fits better in there

Edited by notthematrix at Fri Dec 19, 2014 21:19

Nope its not better
its a thing you do before you give the interfaces a IP or switch them to up.
So in this case the pre-up is the right place for all network based cases you are right.
but in this case it is a device configuration.
I could make a script what derives the vlan addresses from the main eth0 card.
so everybody gets a unique mac address.



You have to log in before you can reply Login | Sign Up

Points Rules