From: František Dvořák Date: Tue, 29 Mar 2016 15:33:42 +0000 (+0200) Subject: VXLAN support and according updates: X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=addf90bf9de1fd820e823247ac88631ea7548193;p=virtualization.git VXLAN support and according updates: * HOWTO * network configuration examples * switch docker network to none * add support for manual IPv4 address --- diff --git a/HOWTO-vxlan.sh b/HOWTO-vxlan.sh new file mode 100755 index 0000000..fb03706 --- /dev/null +++ b/HOWTO-vxlan.sh @@ -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 index 0000000..3fa3efe --- /dev/null +++ b/config/network/if-down.d/vxlan @@ -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 index 0000000..fc3b5c9 --- /dev/null +++ b/config/network/if-up.d/vxlan @@ -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 index 0000000..df4827e --- /dev/null +++ b/config/network/interfaces @@ -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* diff --git a/docker.sh b/docker.sh index c9974cd..03e5b3a 100755 --- a/docker.sh +++ b/docker.sh @@ -32,10 +32,11 @@ # 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 diff --git a/machines/hador-gen-virt-frontend.sh b/machines/hador-gen-virt-frontend.sh index 9386285..7a1a558 100755 --- a/machines/hador-gen-virt-frontend.sh +++ b/machines/hador-gen-virt-frontend.sh @@ -15,6 +15,7 @@ cat <