Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Thomas Bätzler" <t.baetzler@bringe.com>
To: netfilter@vger.kernel.org, fcosta75@gmail.com
Subject: Re: Router with 2 public interfaces
Date: Thu, 05 Jun 2008 14:09:05 +0200	[thread overview]
Message-ID: <4847D761.2080101@bringe.com> (raw)
In-Reply-To: <9b7febdd0805211736k3f34b85i659d4aa761e09bda@mail.gmail.com>

Flávio Costa wrote:
[...]
> When someone connect to webserver by interface eth1 I doesn't work,
> because packets go back by default route (eth2), which is not the same
> they arrive (eth1).

This is a late answer but maybe it's still helpful:

#!/bin/sh

ETH1_GW="xxx.xxx.xxx.xxx"
ETH1_IP="xxx.xxx.xxx.yyy"

iptables -t mangle -F

ip route flush table 4

ip route show table main | grep -Ev ^default | while read ROUTE ; do
   ip route add table 4 $ROUTE
done

ip route add table 4 default via $ETH1_GW

iptables -t mangle -A OUTPUT -s $ETH1_IP -j MARK --set-mark 4

ip rule add fwmark 4 table 4
ip route flush cache

HTH,
Thomas

      reply	other threads:[~2008-06-05 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  0:36 Router with 2 public interfaces Flávio Costa
2008-06-05 12:09 ` Thomas Bätzler [this message]

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=4847D761.2080101@bringe.com \
    --to=t.baetzler@bringe.com \
    --cc=fcosta75@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox