From: Shaun Savage <savages@savages.com>
To: netfilter@vger.kernel.org, linux-net@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: iptables and policy based routing together
Date: Mon, 23 Nov 2015 10:51:05 -0800 [thread overview]
Message-ID: <56536019.5080701@savages.com> (raw)
In-Reply-To: <56535BE4.9020504@savages.com>
> My problem is I have Virtual Private Servers, VPS in different
> locations around the world. I have created a mesh by using openvpn.
> Each VPS phones home and sets up a TCP connection to my RT-AC68U
> running Tomato Shibby 128. I want to route, without thinking, to the
> different VPS depending upon the country. Then that VPS is now my
> exit node. I also run Tor on each VPS.
>
> The VPNs are setup and working. I have added a filter on INPUT that
> only allows sessions to initiate from home.
>
> # iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
>
> This prevents someone who accesses the VPS to get in to my home network.
>
> Next I have setup marking packets according to country
> CN = 86
> IN = 91
> RU = 7
> so on
>
> # iptables -t mangle -m geoip --dst-cc CN,HK -j MARK --set-mark 86
> # iptables -t mangle -m geoip --dst-cc IN -j MARK --set-mark 91
> .....
>
> * BTW how do I debug what fwmark is set?
>
> Now I start adding rules
>
> # ip rule add fwmark 86 table CN
> # ip rule add fwmark 91 table IN
> ......
>
> Now type
>
> # ip rule show
> 0: from all lookup local
> .....
> 32763:
> 32764: from all fwmark 0x5B lookup IN
> 32765: from all fwmark 0x56 lookup CN
> 32766: from all lookup main
> 32767: from all lookup default
>
> Now I get lost, to me this states only if fwmark == 0x56 use table CN
> else do not use table CN
>
> I have played with adding routing to the tables
> # ip route add <gw> dev <tunxx> table CN
> # ????
parent reply other threads:[~2015-11-23 18:51 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <56535BE4.9020504@savages.com>]
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=56536019.5080701@savages.com \
--to=savages@savages.com \
--cc=linux-net@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.