Last active
January 19, 2018 16:37
-
-
Save joaquin386/44293cc729f1715601b18b5c8e6fdfda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node 1: | |
vrrp_script check_openvpn { | |
script "/usr/bin/killall -0 openvpn" | |
interval 5 | |
weight 2 | |
} | |
vrrp_instance VI_52 { | |
interface eth0 | |
state EQUAL | |
virtual_router_id 52 | |
priority 100 | |
advert_int 1 | |
garp_master_delay 5 | |
# notify scripts and alerts are optional | |
# | |
# filenames of scripts to run on transitions | |
# can be unquoted (if just filename) | |
# or quoted (if has parameters) | |
authentication { | |
auth_type PASS | |
auth_pass PASSWORD | |
} | |
track_script { | |
check_openvpn | |
} | |
virtual_ipaddress { | |
10.100.11.106 dev eth0 | |
} | |
unicast_src_ip 10.100.11.107 | |
unicast_peer { | |
10.100.11.108 | |
} | |
# for ANY state transition. | |
# "notify" script is called AFTER the | |
# notify_* script(s) and is executed | |
# with 3 arguments provided by keepalived | |
# (ie don’t include parameters in the notify line). | |
# arguments | |
# $1 = "GROUP"|"INSTANCE" | |
# $2 = name of group or instance | |
# $3 = target state of transition | |
# ("MASTER"|"BACKUP"|"FAULT") | |
notify /usr/local/sbin/notify.sh | |
} | |
Node 2: | |
vrrp_script check_openvpn { | |
script "/usr/bin/killall -0 openvpn" | |
interval 5 | |
weight 2 | |
} | |
vrrp_instance VI_52 { | |
interface eth0 | |
state EQUAL | |
virtual_router_id 52 | |
priority 100 | |
advert_int 1 | |
garp_master_delay 5 | |
# notify scripts and alerts are optional | |
# | |
# filenames of scripts to run on transitions | |
# can be unquoted (if just filename) | |
# or quoted (if has parameters) | |
authentication { | |
auth_type PASS | |
auth_pass PASSWORD | |
} | |
track_script { | |
check_openvpn | |
} | |
virtual_ipaddress { | |
10.100.11.106 dev eth0 | |
} | |
unicast_src_ip 10.100.11.108 | |
unicast_peer { | |
10.100.11.107 | |
} | |
# for ANY state transition. | |
# "notify" script is called AFTER the | |
# notify_* script(s) and is executed | |
# with 3 arguments provided by keepalived | |
# (ie don’t include parameters in the notify line). | |
# arguments | |
# $1 = "GROUP"|"INSTANCE" | |
# $2 = name of group or instance | |
# $3 = target state of transition | |
# ("MASTER"|"BACKUP"|"FAULT") | |
notify /usr/local/sbin/notify.sh | |
} | |
On Dockerfile the CMD is as follow: | |
CMD['openvpn_run'] | |
File: openvpn_run | |
#!/bin/sh | |
# Creates the folder for the tun0 interface | |
# needed by the OpenVPN | |
mkdir -p /dev/net | |
/usr/bin/mknod /dev/net/tun c 10 200 | |
# Restores the iptables configuration | |
# By default it is ACCEPT everything | |
#/usr/sbin/iptables -A INPUT -p ICMP -j DROP | |
# Start keepalived | |
/usr/sbin/keepalived -f /etc/openvpn/keepalived.conf -l | |
# Starting the OpenVPN process | |
/usr/sbin/openvpn /etc/openvpn/server.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment