github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/scripts/tun/readme.md (about) 1 # 2 3 add a tun device tun0 4 5 ```shell 6 ip tuntap add mode tun dev tun0 7 ``` 8 9 set a gateway for tun device 10 11 ```shell 12 ip addr add 172.19.0.1/15 dev tun0 13 ``` 14 15 set tun device up 16 17 ```shell 18 ip link set dev tun0 up 19 ``` 20 21 add tun device config 22 23 ```json 24 "tun": { 25 "name": "", 26 "tun": { 27 "name": "tun://tun0", 28 "mtu": 1500, 29 "gateway": "172.19.0.1", 30 "dns_hijacking": true 31 } 32 } 33 ``` 34 35 set net_interface to origin net device 36 37 ```json 38 "net_interface": "wlo1" 39 ``` 40 41 recommend to enabled fakedns 42 43 ```json 44 "fakedns": true 45 ``` 46 47 delete default route and add tun device route 48 49 ```shell 50 ip route del default 51 ip route add default via 172.19.0.1 dev tun0 metric 1 52 ip route add default via 192.168.100.1 dev wlo1 metric 10 53 ```