VXLAN support and according updates:
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 29 Mar 2016 15:33:42 +0000 (17:33 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 29 Mar 2016 15:34:54 +0000 (17:34 +0200)
* HOWTO
* network configuration examples
* switch docker network to none
* add support for manual IPv4 address

HOWTO-vxlan.sh [new file with mode: 0755]
config/network/if-down.d/vxlan [new file with mode: 0755]
config/network/if-up.d/vxlan [new file with mode: 0755]
config/network/interfaces [new file with mode: 0644]
docker.sh
machines/hador-gen-virt-frontend.sh
machines/hador-gen-virt-master.sh
machines/hador-gen-virt-node.sh

diff --git a/HOWTO-vxlan.sh b/HOWTO-vxlan.sh
new file mode 100755 (executable)
index 0000000..fb03706
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh -xe
+
+ip link add vxlan0 type vxlan id 142 group 239.1.1.1 dev eth0 dstport 4789
+#only two machines peer-to-peer:
+# ip link add vxlan0 type vxlan id 42 remote 2.2.2.2 local 1.1.1.1 dev eth0
+ip link set up dev vxlan0
+
+brctl addbr superbr0
+ip link set up superbr0
+brctl addif superbr0 vxlan0
+
+#ip -d link show vxlan0
diff --git a/config/network/if-down.d/vxlan b/config/network/if-down.d/vxlan
new file mode 100755 (executable)
index 0000000..3fa3efe
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+# VXLAN Example
+
+if [ $IFACE != "eth0" ]; then
+  exit 0
+fi
+
+ip link set down dev vxlan0
+ip link del vxlan0
diff --git a/config/network/if-up.d/vxlan b/config/network/if-up.d/vxlan
new file mode 100755 (executable)
index 0000000..fc3b5c9
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+# VXLAN Example
+
+if [ $IFACE != "eth0" ]; then
+  exit 0
+fi
+
+ip link add vxlan0 type vxlan id 142 group 239.1.1.1 dev eth0 dstport 4789
+ip link set up dev vxlan0
+
+brctl addif overlaybr0 vxlan0
diff --git a/config/network/interfaces b/config/network/interfaces
new file mode 100644 (file)
index 0000000..df4827e
--- /dev/null
@@ -0,0 +1,20 @@
+# VXLAN Example: added overlay0 gateway
+
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
+
+# The secondary network interface
+allow-hotplug eth1
+iface eth1 inet dhcp
+
+auto overlaybr0
+iface overlaybr0 inet manual
+  bridge_ports regex vxlan*
index c9974cd..03e5b3a 100755 (executable)
--- a/docker.sh
+++ b/docker.sh
 #    or disable FETCH_SSH_KEYS
 #
 
-DOCKER_network='ics.muni.cz'
+#DOCKER_network='ics.muni.cz'
 #DOCKER_network='bridge'
+DOCKER_network='none'
 FETCH_SSH_KEYS=${FETCH_SSH_KEYS:-'1'}
-IMAGE='valtri/hadoop-debian7'
+IMAGE='valtri/docker-server-deb7'
 
 # get the first free network device
 devname() {
@@ -122,22 +123,25 @@ docker run -itd \
 #  docker network connect bridge ${FACTER_hostname}
 #fi
 
-# ==== public IPv6 ====
+# ==== public IPv6 + private IPv4 ====
 dev=veth`devname`
 # this is not persistent, let's create a script
 cat << EOF > /etc/docker/${FACTER_hostname}.sh
 mkdir -p /var/run/netns || :
-find -L /etc/ssl/certs -type l -delete || :
+find -L /var/run/netns -type l -delete || :
 pid=\`docker inspect -f '{{.State.Pid}}' ${FACTER_hostname}\`
 
-ln -s /proc/\$pid/ns/net /var/run/netns/\$pid || :
+ln -s /proc/\${pid}/ns/net /var/run/netns/\${pid} || :
 ip link add ${dev}a type veth peer name ${dev}b
 brctl addif ${XENBR} ${dev}a
 ip link set ${dev}a up
-ip link set ${dev}b netns \$pid
-ip netns exec \$pid ip link set dev ${dev}b name public6
-ip netns exec \$pid ip link set public6 address ${FACTER_macaddress}
-ip netns exec \$pid ip link set public6 up
+ip link set ${dev}b netns \${pid}
+ip netns exec \${pid} ip link set dev ${dev}b name ethx0
+ip netns exec \${pid} ip link set ethx0 address ${FACTER_macaddress}
+ip netns exec \${pid} ip link set ethx0 up
 EOF
+if [ -n "${FACTER_ip}" ]; then
+       echo "ip netns exec \${pid} ip addr add ${FACTER_ip}/24 dev ethx0" >> /etc/docker/${FACTER_hostname}.sh
+fi
 chmod +x /etc/docker/${FACTER_hostname}.sh
 sh -xe /etc/docker/${FACTER_hostname}.sh
index 9386285..7a1a558 100755 (executable)
@@ -15,6 +15,7 @@ cat <<EOF
 export FACTER_fqdn="hador-${NVIRT}.ics.muni.cz"
 export FACTER_hostname=\`echo \$FACTER_fqdn | sed 's/\..*//g'\`
 export FACTER_macaddress="02:93:0a:00:${NVIRT_HEX}:${NIP_HEX}"
+export FACTER_ip="10.0.${NVIRT}.`expr ${NIP} + 100`"
 
 export XENBR="br0"
 export SIZE_ROOTFS="300G"
index 3c346f5..1a144fa 100755 (executable)
@@ -20,6 +20,7 @@ cat <<EOF
 export FACTER_fqdn="hador-c${N}-${NVIRT}.ics.muni.cz"
 export FACTER_hostname=\`echo \$FACTER_fqdn | sed 's/\..*//g'\`
 export FACTER_macaddress="02:93:0a:00:${NVIRT_HEX}:${NIP_HEX}"
+export FACTER_ip="10.0.${NVIRT}.`expr ${N} + 100`"
 
 export XENBR="br0"
 export SIZE_ROOTFS="300G"
index 7d21bf7..3c24987 100755 (executable)
@@ -26,6 +26,7 @@ cat <<EOF
 export FACTER_fqdn="hador${N}-${NVIRT}.ics.muni.cz"
 export FACTER_hostname=\`echo \$FACTER_fqdn | sed 's/\..*//g'\`
 export FACTER_macaddress="02:93:0a:00:${NVIRT_HEX}:${N_HEX}"
+export FACTER_ip="10.0.${NVIRT}.${N}"
 
 export XENBR="br0"
 export SIZE_ROOTFS="300G"