# Configuration file for setting IP addresses for a network interface. INTERFACE="$1" DOCKER_USER_INTERFACE=net-tools0 HWADDR="00:00:5e:00:53:ff" IPV6_ADDR_1="2001:db8::254" IPV6_ROUTE_1="2001:db8::/64" IPV4_ADDR_1="192.0.2.254" IPV4_ROUTE_1="192.0.2.0/24" DOCKER_INTERFACE=$( docker network create \ --subnet $IPV4_ROUTE_1 \ --gateway $IPV4_ADDR_1 \ --ipv6=true \ --subnet $IPV6_ROUTE_1 \ --gateway $IPV6_ADDR_1 \ $DOCKER_USER_INTERFACE ) if [ $? -eq 0 ] then DOCKER_INTERFACE="br-$(echo $DOCKER_INTERFACE | cut -c -12)" ip link set dev $INTERFACE address $HWADDR brctl addif $DOCKER_INTERFACE $INTERFACE # By default the LLDP packets are not crossing the bridge interface # so need to enable it here. echo 16384 > /sys/class/net/${DOCKER_INTERFACE}/bridge/group_fwd_mask ip link set dev $INTERFACE up else DOCKER_INTERFACE=br-"$(docker network ls | \ grep $DOCKER_USER_INTERFACE | \ (read br rest ; echo $br) )" fi echo Created bridge: $DOCKER_INTERFACE echo Created docker net: $DOCKER_USER_INTERFACE