init: transmission

This commit is contained in:
Swarsel 2024-10-05 13:44:55 +02:00
parent 3a56b30a91
commit 1e7f25c979
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
13 changed files with 971 additions and 26 deletions

View file

@ -1,8 +1,8 @@
#! /usr/bin/env bash
export INTERFACE="tun0"
export VPNUSER="vpn"
export LOCALIP="192.168.1.107"
export NETIF="enp7s0"
export LOCALIP="192.168.1.2"
export NETIF="enp3s0"
# flushes all the iptables rules, if you have other rules to use then add them into the script
iptables -F -t nat
@ -34,14 +34,7 @@ iptables -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# reject connections from predator IP going over $NETIF
iptables -A OUTPUT ! --src $LOCALIP -o $NETIF -j REJECT
VPNIF="tun0"
VPNUSER="vpn"
GATEWAYIP=$(ifconfig $VPNIF | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})' | tail -n1)
if [[ `ip rule list | grep -c 0x1` == 0 ]]; then
ip rule add from all fwmark 0x1 lookup $VPNUSER
fi
ip route replace default via $GATEWAYIP table $VPNUSER
ip route append default via 127.0.0.1 dev lo table $VPNUSER
ip route flush cache
# Start routing script
/etc/openvpn/routing.sh
exit 0