Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
To: "Perol.Chen" <perol.chen@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Split traffic between VPN and local interface
Date: Thu, 31 Mar 2016 14:23:26 +0200	[thread overview]
Message-ID: <56FD16BE.6050605@plouf.fr.eu.org> (raw)
In-Reply-To: <CAL6-xCbC6gDCYMZ9KhctcGRQ=6kQZL2oZGNEV6NT9NQRO44BUQ@mail.gmail.com>

Le 31/03/2016 07:32, Perol.Chen a écrit :
> Dear all:
>
> I start one vpn client on my computer, but I want my country's traffic
> direct from local interface,
>
> because the ip list is large, so I save them to ipset named chinaip.
>
> I use commands below split the traffic, 192.168.1.1 is local interface
> gateway, 10.7.0.2 is the vpn tun ip.
>
>
> id="11"
> ip rule add fwmark $id lookup $id
> ip route add default via 192.168.1.1 table $id
> iptables -t mangle -I OUTPUT 1 -m set --match-set chinaip dst -j MARK
> --set-mark $id
> iptables -t nat -A POSTROUTING -s 10.7.0.2 -o eth0 -j MASQUERADE
>
>
> wireshark show the traffic send to eth0, but the local process can not
> receive data.
>
> 128    5.583482000    192.168.1.118    180.149.134.141    TCP    74
> 33474 > http [SYN] Seq=0 Win=27840 Len=0 MSS=1392 SACK_PERM=1
> TSval=17843425 TSecr=0 WS=128
>
> 129    5.586962000    180.149.134.141    192.168.1.118    TCP    66
> http > 33474 [SYN, ACK] Seq=0 Ack=1 Win=14600 Len=0 MSS=1448
> SACK_PERM=1 WS=128
>
> 249    6.332233000    192.168.1.118    180.149.134.141    TCP    74
> [TCP Retransmission] 33473 > http [SYN] Seq=0 Win=27840 Len=0 MSS=1392
> SACK_PERM=1 TSval=17843613 TSecr=0 WS=128
>
> 250    6.335188000    180.149.134.141    192.168.1.118    TCP    66
> [TCP Retransmission] http > 33473 [SYN, ACK] Seq=0 Ack=1 Win=14600
> Len=0 MSS=1448 SACK_PERM=1 WS=128
>
> There are all TCP Retransmission, Are there something problems?

You probably need to disable rp_filter on eth0.

  reply	other threads:[~2016-03-31 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  5:32 Split traffic between VPN and local interface Perol.Chen
2016-03-31 12:23 ` Pascal Hambourg [this message]
2016-04-01 14:43   ` Perol.Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FD16BE.6050605@plouf.fr.eu.org \
    --to=pascal@plouf.fr.eu.org \
    --cc=netfilter@vger.kernel.org \
    --cc=perol.chen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox