forked from zephyrproject-rtos/net-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.conf
37 lines (27 loc) · 832 Bytes
/
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
# 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
ip link set dev $INTERFACE up
else
DOCKER_INTERFACE=br-"$(docker network ls | \
grep $DOCKER_USER_INTERFACE | \
(read br rest ; echo $br) )"
fi
echo $DOCKER_INTERFACE