mirror of
https://github.com/nadoo/glider.git
synced 2025-02-24 01:45:39 +08:00
examples: add example 7. Transparent Proxy with dnsmasq
This commit is contained in:
parent
a839f8d195
commit
432dc9485b
@ -4,9 +4,5 @@ verbose=True
|
|||||||
|
|
||||||
listen=:8443
|
listen=:8443
|
||||||
|
|
||||||
# NOTE HERE:
|
# parse all *.rule files in rules.d folder
|
||||||
# specify a rule file
|
rules-dir=rules.d
|
||||||
rulefile=office.rule
|
|
||||||
|
|
||||||
# specify another rule file
|
|
||||||
rulefile=home.rule
|
|
||||||
|
43
config/examples/8.transparent_proxy_with_dnsmasq/README.md
Normal file
43
config/examples/8.transparent_proxy_with_dnsmasq/README.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
## 7. Transparent Proxy with dnsmasq
|
||||||
|
|
||||||
|
#### Setup a redirect proxy and a dnstunnel with glider
|
||||||
|
glider.conf
|
||||||
|
```bash
|
||||||
|
verbose=True
|
||||||
|
listen=redir://:1081
|
||||||
|
listen=dnstun://5353=8.8.8.8:53
|
||||||
|
forward=http://forwarder1:8080,socks5://forwarder2:1080
|
||||||
|
forward=http://1.1.1.1:8080
|
||||||
|
strategy=rr
|
||||||
|
checkwebsite=www.apple.com
|
||||||
|
checkduration=30
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Create a ipset manually
|
||||||
|
```bash
|
||||||
|
ipset create myset hash:ip
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Config dnsmasq
|
||||||
|
```bash
|
||||||
|
server=/example1.com/127.0.0.1#5353
|
||||||
|
ipset=/example1.com/myset
|
||||||
|
server=/example2.com/127.0.0.1#5353
|
||||||
|
ipset=/example2.com/myset
|
||||||
|
server=/example3.com/127.0.0.1#5353
|
||||||
|
ipset=/example4.com/myset
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Config iptables on your linux gateway
|
||||||
|
```bash
|
||||||
|
iptables -t nat -I PREROUTING -p tcp -m set --match-set myset dst -j REDIRECT --to-ports 1081
|
||||||
|
iptables -t nat -I OUTPUT -p tcp -m set --match-set myset dst -j REDIRECT --to-ports 1081
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you can startup glider and dnsmasq, the whole process:
|
||||||
|
1. all dns requests for domain example1.com will be forward to glider(:5353) by dnsmasq
|
||||||
|
2. glider will forward dns requests to 8.8.8.8:53 in tcp via forwarders
|
||||||
|
3. the resolved ip address will be add to ipset "myset" by dnsmasq
|
||||||
|
4. all tcp requests to example1.com will be redirect to glider(:1081)
|
||||||
|
5. glider then forward requests to example1.com via forwarders
|
16
config/examples/8.transparent_proxy_with_dnsmasq/glider.conf
Normal file
16
config/examples/8.transparent_proxy_with_dnsmasq/glider.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
# Verbose mode, print logs
|
||||||
|
verbose=True
|
||||||
|
|
||||||
|
listen=redir://:1081
|
||||||
|
listen=dnstun://5353=8.8.8.8:53
|
||||||
|
|
||||||
|
forward=http://forwarder1:8080,socks5://forwarder2:1080
|
||||||
|
forward=http://1.1.1.1:8080
|
||||||
|
|
||||||
|
strategy=rr
|
||||||
|
checkwebsite=www.apple.com
|
||||||
|
checkduration=30
|
||||||
|
|
||||||
|
# parse all *.rule files in rules.d folder
|
||||||
|
#rules-dir=rules.d
|
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
forward=http://forwarder4:8080
|
||||||
|
|
||||||
|
# first connect forwarder1 then forwarder2 then internet
|
||||||
|
forward=http://forwarder5:8080,socks6://forwarder3:1080
|
||||||
|
|
||||||
|
|
||||||
|
# Round Robin mode: rr
|
||||||
|
# High Availability mode: ha
|
||||||
|
strategy=rr
|
||||||
|
|
||||||
|
checkwebsite=www.apple.com
|
||||||
|
checkduration=30
|
||||||
|
|
||||||
|
|
||||||
|
# matches 192.168.0.0/16
|
||||||
|
cidr=192.168.0.0/16
|
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
forward=http://forwarder1:8080
|
||||||
|
|
||||||
|
# first connect forwarder2 then forwarder3 then internet
|
||||||
|
forward=http://forwarder2:8080,socks5://forwarder3:1080
|
||||||
|
|
||||||
|
|
||||||
|
# Round Robin mode: rr
|
||||||
|
# High Availability mode: ha
|
||||||
|
strategy=rr
|
||||||
|
|
||||||
|
checkwebsite=www.apple.com
|
||||||
|
checkduration=30
|
||||||
|
|
||||||
|
|
||||||
|
# matches 172.16.0.0/24
|
||||||
|
cidr=172.16.0.0/24
|
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# Verbose mode, print logs
|
||||||
|
verbose=True
|
||||||
|
|
||||||
|
listen=:8443
|
||||||
|
|
||||||
|
# parse all *.rule files in rules.d folder
|
||||||
|
rules-dir=rules.d
|
@ -113,7 +113,7 @@ dnsserver=8.8.8.8:53
|
|||||||
# ----------------
|
# ----------------
|
||||||
# Create and mange ipset on linux based on destinations in rule files
|
# Create and mange ipset on linux based on destinations in rule files
|
||||||
# - add ip/cidrs in rule files on startup
|
# - add ip/cidrs in rule files on startup
|
||||||
# - add resolved ips for domains in rule files by dns forwarder server
|
# - add resolved ips for domains in rule files by dns forwarding server
|
||||||
# Usually used in transparent proxy mode on linux
|
# Usually used in transparent proxy mode on linux
|
||||||
ipset=glider
|
ipset=glider
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user