Eu tenho tentado rotear algum tráfego pela minha VPN e o resto diretamente pelo meu provedor, e me deparei com este artigo:
No entanto, decidi tentar minha mão e fazer minhas próprias regras. Acredito que realizei o que precisava sem usar tantas regras quantas as listas de artigos.
Espero encontrar alguém gentil o suficiente para revisar minhas regras e me informar se há vazamentos ou erros. Confirmei que o tráfego correto está sendo roteado através da VPN observando os endereços IP. Aqui estão minhas regras:
Roteamento:
$ 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 e tabelas 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
Verificações de IP:
$ curl ipinfo.io/ip
xxx.xx.xxx.177
$ sudo -u debian-transmission curl ipinfo.io/ip
68.235.53.24