mirror of
https://github.com/MarkusMcNugen/docker-qBittorrentvpn
synced 2024-11-25 20:14:58 +00:00
Update iptables.sh
This commit is contained in:
parent
fdbfcf1e06
commit
e76192d13f
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Forked from binhex's OpenVPN dockers
|
# Forked from binhex's OpenVPN dockers
|
||||||
|
|
||||||
|
DEBUG=false
|
||||||
|
|
||||||
# Wait until tunnel is up
|
# Wait until tunnel is up
|
||||||
while : ; do
|
while : ; do
|
||||||
tunnelstat=$(netstat -ie | grep -E "tun|tap")
|
tunnelstat=$(netstat -ie | grep -E "tun|tap")
|
||||||
@ -13,11 +15,6 @@ done
|
|||||||
|
|
||||||
echo "[info] WebUI port defined as ${WEBUI_PORT}" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[info] WebUI port defined as ${WEBUI_PORT}" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
|
|
||||||
# ip route
|
|
||||||
###
|
|
||||||
|
|
||||||
DEBUG=false
|
|
||||||
|
|
||||||
# strip whitespace from start and end of LAN_NETWORK
|
# strip whitespace from start and end of LAN_NETWORK
|
||||||
export LAN_NETWORK=$(echo "${LAN_NETWORK}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
export LAN_NETWORK=$(echo "${LAN_NETWORK}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
||||||
echo "[info] LAN Network defined as ${LAN_NETWORK}" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[info] LAN Network defined as ${LAN_NETWORK}" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
@ -27,7 +24,7 @@ DEFAULT_GATEWAY=$(ip -4 route list 0/0 | cut -d ' ' -f 3)
|
|||||||
echo "[info] Default gateway defined as ${DEFAULT_GATEWAY}" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[info] Default gateway defined as ${DEFAULT_GATEWAY}" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
|
|
||||||
#echo "[info] Adding ${LAN_NETWORK} as route via docker eth0" | ts '%Y-%m-%d %H:%M:%.S'
|
#echo "[info] Adding ${LAN_NETWORK} as route via docker eth0" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
#ip route add "${LAN_NETWORK}" via "${DEFAULT_GATEWAY}" dev eth0
|
ip route add "${LAN_NETWORK}" via "${DEFAULT_GATEWAY}" dev eth0
|
||||||
|
|
||||||
echo "[info] ip route defined as follows..." | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[info] ip route defined as follows..." | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
echo "--------------------"
|
echo "--------------------"
|
||||||
@ -50,7 +47,12 @@ if [[ $iptable_mangle_exit_code == 0 ]]; then
|
|||||||
echo "[info] iptable_mangle support detected, adding fwmark for tables" | ts '%Y-%m-%d %H:%M:%.S'
|
echo "[info] iptable_mangle support detected, adding fwmark for tables" | ts '%Y-%m-%d %H:%M:%.S'
|
||||||
|
|
||||||
# setup route for qbittorrent webui using set-mark to route traffic for port 8080 to eth0
|
# setup route for qbittorrent webui using set-mark to route traffic for port 8080 to eth0
|
||||||
|
if [ -z "${WEBUI_PORT}" ]; then
|
||||||
echo "8080 webui" >> /etc/iproute2/rt_tables
|
echo "8080 webui" >> /etc/iproute2/rt_tables
|
||||||
|
else
|
||||||
|
echo "${WEBUI_PORT} webui" >> /etc/iproute2/rt_tables
|
||||||
|
fi
|
||||||
|
|
||||||
ip rule add fwmark 1 table webui
|
ip rule add fwmark 1 table webui
|
||||||
ip route add default via ${DEFAULT_GATEWAY} table webui
|
ip route add default via ${DEFAULT_GATEWAY} table webui
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user