File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ Environment variables defaults are set in **image/environment/default.yaml**
7777See how to [ set your own environment variables] ( #set-your-own-environment-variables )
7878
7979
80- - ** KEEPALIVED_INTERFACE** : Keepalived network interface. Defaults to ` eth0 `
80+ - ** KEEPALIVED_INTERFACE** : Keepalived network interface. Autodetected to interface with default route (see ` ip route ` )
8181- ** KEEPALIVED_PASSWORD** : Keepalived password. Defaults to ` d0cker `
8282- ** KEEPALIVED_PRIORITY** Keepalived node priority. Defaults to ` 150 `
8383- ** KEEPALIVED_ROUTER_ID** Keepalived virtual router ID. Defaults to ` 51 `
Original file line number Diff line number Diff line change 11KEEPALIVED_COMMAND_LINE_ARGUMENTS : --log-detail --dump-conf
22
3- KEEPALIVED_INTERFACE : eth0
3+ # set the interface here to disable the default interface auto detection
4+ # KEEPALIVED_INTERFACE: eth0
5+
46KEEPALIVED_PASSWORD : d0cker
57
68# For electing MASTER, highest priority wins.
Original file line number Diff line number Diff line change @@ -8,6 +8,17 @@ FIRST_START_DONE="${CONTAINER_STATE_DIR}/docker-keepalived-first-start-done"
88# container first start
99if [ ! -e " $FIRST_START_DONE " ]; then
1010
11+ # autodetect the default network interface
12+ if [ -z " $KEEPALIVED_INTERFACE " ]; then
13+ KEEPALIVED_INTERFACE=$( ip route | awk ' /default/ { print $5 }' )
14+ if [ -z " $KEEPALIVED_INTERFACE " ]; then
15+ echo " ERROR: Couldn't autodetect the default network interface, specify it manually."
16+ exit 1
17+ else
18+ echo " Autodetected default network interface: $KEEPALIVED_INTERFACE "
19+ fi
20+ fi
21+
1122 #
1223 # bootstrap config
1324 #
You can’t perform that action at this time.
0 commit comments