Затея :)
text
ip route add default dev tun1 table web
ip rule add fwmark 100 table web
ip route flush cache
iptables -t mangle -I OUTPUT -d 8.8.4.4 -j MARK --set-mark 100
iptables -t nat -A POSTROUTING -m mark --mark 100 -o tun1 -j MASQUERADE
На клиенте где маркируються пакеты.
text
ping 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
^C
--- 8.8.4.4 ping statistics ---
12 packets transmitted, 0 received, 100% packet loss, time 11087ms
text
10:25:08.665791 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 1, length 64
10:25:08.690906 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 1, length 64
10:25:09.665560 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 2, length 64
10:25:09.690905 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 2, length 64
10:25:10.673048 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 3, length 64
10:25:10.698938 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 3, length 64
10:25:11.681122 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 4, length 64
10:25:11.707041 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 4, length 64
10:25:12.689122 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 5, length 64
10:25:12.714472 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 5, length 64
На сервере 192.168.14.1 или куда отправляем tun1
text
10:28:21.456843 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 65, length 64
10:28:21.471369 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 65, length 64
10:28:22.463611 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 66, length 64
10:28:22.478243 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 66, length 64
10:28:23.472527 IP 192.168.14.2 > google-public-dns-b.google.com: ICMP echo request, id 3793, seq 67, length 64
10:28:23.486969 IP google-public-dns-b.google.com > 192.168.14.2: ICMP echo reply, id 3793, seq 67, length 64