All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glaucius Djalma Pereira Junior <glaucius@gmail.com>
To: Fabian Wolter <netfilter-ml@fabian-wolter.de>,
	netfilter@lists.netfilter.org
Subject: Re: How to masquerade when using ROUTE
Date: Sun, 8 May 2005 11:55:33 -0300	[thread overview]
Message-ID: <f48e768e05050807559b74d35@mail.gmail.com> (raw)
In-Reply-To: <427D52FA.8020805@fabian-wolter.de>

take a look in  iproute2,

lartc.org  , using  iptables and iproute to do it 

1) create an entry in /etc/iproute2/rt_tables

echo "200            fabian

2) create the route default to route fabian
ip route add default via x.x.x.x dev ethX table fabian

3) create the rules 

iptables -t mangle -A PREROUTING -p tcp --dport 25 -j MARK --set-mark 3

4) routing the packets 

ip rule add from fwmark 3 lookup fabian prio 1


be happy 



On 5/7/05, Fabian Wolter <netfilter-ml@fabian-wolter.de> wrote:
> Hi,
> 
> I want to route all outgoing port-25-traffic produced by the clients
> over ppp1. The rest schould take the default route over ppp0.
> 
> I used the following command:
> 
> iptables -A PREROUTING -p tcp --dport 25 -t mangle -i eth0 -j ROUTE
> --oif ppp1
> 
> But the source addresses of the packets are wrong as "tcpdump -ni ppp1"
> shows:
> 
> 01:20:24.422756 IP 192.168.0.4.32825 > 160.45.10.13.25: S
> 2020082843:2020082843(0) win 5840 <mss 1460,sackOK,timestamp 266850[|tcp]>
> 
> 192.168.0.4 is the IP adress of the client which tried to connect to the
> mailserver 160.45.10.13.25.
> 
> Masquarding is done to 192.168.0.0/24:
> 
> # iptables -t nat -L POSTROUTING
> Chain POSTROUTING (policy ACCEPT)
> target     prot opt source               destination
> MASQUERADE  all  --  192.168.0.0/24       anywhere
> 
> My default route is set to ppp0.
> 
> So, how can I replace/masquerade the 192.168.0.4 by the official IP
> address of ppp1?
> 
> Regards,
> Fabian
> 
> 


-- 
Glaucius Djalma Pereira Junior
glaucius@gmail.com


  reply	other threads:[~2005-05-08 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-07 23:44 How to masquerade when using ROUTE Fabian Wolter
2005-05-08 14:55 ` Glaucius Djalma Pereira Junior [this message]
2005-05-08 16:22   ` Fabian Wolter
2005-05-08 21:12     ` Glaucius Djalma Pereira Junior
2005-05-09  6:14 ` Taylor, Grant
2005-05-09 12:19   ` Glaucius Djalma Pereira Junior

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=f48e768e05050807559b74d35@mail.gmail.com \
    --to=glaucius@gmail.com \
    --cc=netfilter-ml@fabian-wolter.de \
    --cc=netfilter@lists.netfilter.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.