-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathdocker.conf
42 lines (31 loc) · 1.04 KB
/
docker.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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