Docker DEV (#737)

This commit is contained in:
Po Chen
2022-07-13 15:56:34 +10:00
committed by Jamil
parent 55a19c994c
commit bfbb671d32
10 changed files with 245 additions and 17 deletions

8
scripts/dev_start.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
ip link add dev wg-firezone type wireguard
ip address add dev wg-firezone 10.3.2.1/24
ip -6 address add dev wg-firezone fd00::3:2:1/120
ip link set up dev wg-firezone
mix start

9
scripts/post-down-wg.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
FIREZONE_DEV_V4='172.28.0.0/16'
FIREZONE_DEV_V6='2001:3990:3990::/64'
TABLE=333444
sudo ip -4 rule del from $FIREZONE_DEV_V4 table $TABLE
sudo ip -4 route flush table $TABLE
sudo ip -6 rule del from $FIREZONE_DEV_V6 table $TABLE
sudo ip -6 route flush table $TABLE

19
scripts/post-up-wg.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
FIREZONE_DEV_V4='172.28.0.0/16'
FIREZONE_DEV_V6='2001:3990:3990::/64'
TABLE=333444
DEFAULT_ROUTE_V4=$(sudo ip -4 route | grep ^default)
DOCKER_ROUTE_V4=$(sudo ip -4 route | grep ^$FIREZONE_DEV_V4)
DEFAULT_ROUTE_V6=$(sudo ip -6 route | grep ^default)
DOCKER_ROUTE_V6=$(sudo ip -6 route | grep ^$FIREZONE_DEV_V6)
sudo ip -4 route add $DEFAULT_ROUTE_V4 table $TABLE
sudo ip -4 route add $DOCKER_ROUTE_V4 table $TABLE
sudo ip -6 route add $DOCKER_ROUTE_V6 table $TABLE
if [ ! -z "$DEFAULT_ROUTE_V6"]
then
sudo ip -6 route add $DEFAULT_ROUTE_V6 table $TABLE
fi
sudo ip -4 rule add from $FIREZONE_DEV_V4 table $TABLE
sudo ip -6 rule add from $FIREZONE_DEV_V6 table $TABLE