-
Notifications
You must be signed in to change notification settings - Fork 2
/
direct
40 lines (33 loc) · 1.6 KB
/
direct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/bash
# This is for VPN users: oftentimes you need to access certain websites directly while bypassing VPN and you don't want to disable it.
# This script allows you to run any application, so that it talked to the Internet from your primary interface, not your VPN interface.
# This requires https://github.com/Intika-Linux-Firewall/Bind-Interface-IP
# Compile both for the i686 and x86-64 architectures and this script will work for an application regardless of its bitness
#
# 2022-08-23 15:20:09 bloody tired of Google who hates VPN
# 2022-11-07 20:39:28 add `exec` to avoid an extra hanging bash process
# 2022-12-22 10:47:51 UTC updated description
ifdirect=`ip -br link show | awk '/^en/{print $1}'`
ipdirect=`ip -4 -br addr show dev "$ifdirect" | awk '{print $3}' | awk -F '/' '{print $1}'`
echo "Using IP adress $ipdirect ..."
test -z "$1" && echo "Need a command to run :-)" && exit 1
export BIND_ADDR="$ipdirect"
export LD_PRELOAD="/usr/local/lib/bind.so /usr/local/lib64/bind.so"
exec "$@"
# This requires some preparation
# 1. For rc.local
## v2 working 2020-11-24 15:34:04
#direct2()
#{
# grep -q "200 direct" /etc/iproute2/rt_tables || echo -e "\n# `date`\n200 direct" >> /etc/iproute2/rt_tables
# ifdirect=`ip l | grep " en" | awk -F : '{print $2}' | sed 's/ //'`
# if [ -n "$ifdirect" ]; then
# ip rule add from 192.168.0.1/24 table direct prio 1
# ip route add default via 192.168.0.1 dev "$ifdirect" table direct
# fi
#}
# 2. For /etc/iproute2/rt_tables
## Tue Nov 24 03:24:42 PM 2020
# 200 direct
# 3. And lastly
# https://github.com/Intika-Linux-Firewall/Bind-Interface-IP