VPN 트래픽 라우팅 검사

VPN 트래픽 라우팅 검사

일부 트래픽은 VPN을 통해 라우팅하고 나머지는 ISP를 통해 직접 라우팅하려고 시도하다가 다음 기사를 발견했습니다.

http://www.htpcguides.com/force-torrent-traffic-vpn-split-tunnel-debian-8-ubuntu-16-04/

하지만 나는 한번 시도해 보고 나만의 규칙을 만들기로 결정했습니다. 나는 나열된 기사만큼 많은 규칙을 사용하지 않고도 내가 해야 할 일을 달성했다고 믿습니다.

내 규칙을 검토하고 허점이나 오류가 있으면 알려줄 수 있는 좋은 사람을 찾고 싶습니다. IP 주소를 확인하여 VPN을 통해 올바른 트래픽이 라우팅되고 있음을 확인했습니다. 내 규칙은 다음과 같습니다.

라우팅:

$ ip rule
0:  from all lookup local 
32765:  from all fwmark 0x1 lookup 128 
32766:  from all lookup main 
32767:  from all lookup default 


$ ip route show table main
default via 192.168.0.1 dev eth0 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.129  metric 202 


$ ip route show table 128
default via 10.8.8.249 dev tun0 
10.8.8.249 dev tun0  scope link  src 10.8.8.250 
68.235.53.24 via 192.168.0.1 dev eth0 
192.168.0.0/24 dev eth0  scope link 

Mangle 및 NAT 테이블:

sudo iptables -t mangle -L -v
Chain PREROUTING (policy ACCEPT 2964K packets, 3153M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 2964K packets, 3153M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 1651K packets, 424M bytes)
 pkts bytes target     prot opt in     out     source               destination         
 917K  203M MARK       all  --  any    any     anywhere             anywhere             
owner UID match debian-transmission MARK set 0x1

Chain POSTROUTING (policy ACCEPT 1651K packets, 424M bytes)
 pkts bytes target     prot opt in     out     source               destination 


$ sudo iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 2814 packets, 1123K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 2799 packets, 1122K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 18894 packets, 1297K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 3327 packets, 299K bytes)
 pkts bytes target     prot opt in     out     source               destination         
15567  998K MASQUERADE  all  --  any    tun0    anywhere             anywhere       

IP 확인:

$ curl ipinfo.io/ip
xxx.xx.xxx.177
$ sudo -u debian-transmission curl ipinfo.io/ip
68.235.53.24

관련 정보