Repository : ssh://git@open-mesh.org/doc
On branches: backup-redmine/2019-11-07,master
commit 2c66f603c8b320b391d4daa3ff933eabf73e0dfa Author: Sven Eckelmann sven@narfation.org Date: Sun Oct 27 11:07:21 2019 +0000
doc: open-mesh/Mixing_VM_with_gluon_hardware
2c66f603c8b320b391d4daa3ff933eabf73e0dfa open-mesh/Kernel_hacking_Debian_image.textile | 43 -------------------- open-mesh/Mixing_VM_with_gluon_hardware.textile | 54 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 43 deletions(-)
diff --git a/open-mesh/Kernel_hacking_Debian_image.textile b/open-mesh/Kernel_hacking_Debian_image.textile index 7c0887b..69d4af0 100644 --- a/open-mesh/Kernel_hacking_Debian_image.textile +++ b/open-mesh/Kernel_hacking_Debian_image.textile @@ -404,49 +404,6 @@ ssh root@192.168.251.51 'tcpdump -i enp3s0 -s 0 -U -n -w - "port not 22"' > remo wireshark -k -i remote-dump </pre>
-h2. Connect to gluon VXLAN - -Gluon supports meshing over VXLAN. The gluon node just has to enable Mesh-on-WAN or Mesh-on-LAN and then it is possible to connect our virtual machine with the WAN/LAN port of the machine. Let us assume that the host running the Qemu instances is using interface <code>enp8s0</code> for this connection and that the qemu instances are all connected to bridge <code>br-qemu</code. - -The first information we have to get from from the gluon node is the VXLAN id. It can be queried on the gluon node via: <pre>lua -e 'print(tonumber(require("gluon.util").domain_seed_bytes("gluon-mesh-vxlan", 3), 16))'</pre> - -We must then create a vxlan interface on top of our normal ethernet interface, make sure that the ethernet interface is using a EUI64 based IPv6 link local address and insert the new interface in our bridge - -<pre> -#! /bin/sh - -BRIDGE=br-qemu -ETH=enp8s0 -VXLAN=vx_mesh_lan -# calculated on gluon node -VXLAN_ID=12094920 - -xor2() { - echo -n "${1:0:1}" - echo -n "${1:1:1}" | tr '0123456789abcdef' '23016745ab89efcd' -} - -interface_linklocal() { - local macaddr="$(cat /sys/class/net/"${ETH}"/address)" - local oldIFS="$IFS"; IFS=':'; set -- $macaddr; IFS="$oldIFS" - - echo "fe80::$(xor2 "$1")$2:$3ff:fe$4:$5$6" -} - -sudo ip addr add "$(interface_linklocal)"/64 dev "$ETH" -sudo ip link del "${VXLAN}" -sudo ip -6 link add "${VXLAN}" type vxlan \ - id "${VXLAN_ID}" \ - dstport 4789 \ - local "$(interface_linklocal)" \ - group ff02::15c \ - dev "${ETH}" \ - udp6zerocsumtx udp6zerocsumrx \ - ttl 1 - -sudo ip link set "${VXLAN}" up master "${BRIDGE}" -</pre> - h2. Using GDB
The instances are listening on 127.0.0.1 TCP port <code>23000 + instance_no</code>. We will use in the following example instance 1. The gdb debugger can be started from the linux source directory and all <code>lx-*</code> helpers will automatically be loaded. diff --git a/open-mesh/Mixing_VM_with_gluon_hardware.textile b/open-mesh/Mixing_VM_with_gluon_hardware.textile new file mode 100644 index 0000000..c04ebe5 --- /dev/null +++ b/open-mesh/Mixing_VM_with_gluon_hardware.textile @@ -0,0 +1,54 @@ +h1. Mixing VM with gluon hardware + +The "freifunk gluon":https://github.com/freifunk-gluon/gluon firmware is a relative common framework to create OpenWrt based firmware images for mesh systems with central VPN servers. The [[Emulation_Environment|emulation environments]] using Linux bridge as interconnect can be directly connected to a device running a gluon firmware. + +!gluon-vxlan.png! + +h2. gluon adjustments + +The current gluon version allows to change the LAN (or WAN) ports to mesh ports. This can either be enabled in the setup mode webinterface or using the "commandline interface":https://github.com/freifunk-gluon/gluon/wiki/Commandline-administration#mesh.... + +The packets will be encapsulated in a VXLAN packet. The VXLAN uses an id which has to be calculated on the node via: + +<pre>lua -e 'print(tonumber(require("gluon.util").domain_seed_bytes("gluon-mesh-vxlan", 3), 16))'</pre> + +h2. Connect to gluon VXLAN + +The configured gluon hardware has to be connected via ethernet to the our emulation host. Let us assume that the host is using interface <code>enp8s0</code> for this connection and that the qemu instances are all connected to bridge <code>br-qemu</code>. + +We must then create a vxlan interface on top of our normal ethernet interface, make sure that the ethernet interface is using an EUI64 based IPv6 link local address and insert the new interface in our bridge + +<pre> +#! /bin/sh + +BRIDGE=br-qemu +ETH=enp8s0 +VXLAN=vx_mesh_lan +# calculated on gluon node +VXLAN_ID=12094920 + +xor2() { + echo -n "${1:0:1}" + echo -n "${1:1:1}" | tr '0123456789abcdef' '23016745ab89efcd' +} + +interface_linklocal() { + local macaddr="$(cat /sys/class/net/"${ETH}"/address)" + local oldIFS="$IFS"; IFS=':'; set -- $macaddr; IFS="$oldIFS" + + echo "fe80::$(xor2 "$1")$2:$3ff:fe$4:$5$6" +} + +sudo ip addr add "$(interface_linklocal)"/64 dev "$ETH" +sudo ip link del "${VXLAN}" +sudo ip -6 link add "${VXLAN}" type vxlan \ + id "${VXLAN_ID}" \ + dstport 4789 \ + local "$(interface_linklocal)" \ + group ff02::15c \ + dev "${ETH}" \ + udp6zerocsumtx udp6zerocsumrx \ + ttl 1 + +sudo ip link set "${VXLAN}" up master "${BRIDGE}" +</pre> \ No newline at end of file