Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Dmitry Melekhov <dm@belkam.com>
To: netfilter@lists.netfilter.org
Subject: iptables -A OUTPUT --set-mark , routing
Date: Wed, 21 Jul 2004 14:03:40 +0500	[thread overview]
Message-ID: <40FE316C.50109@belkam.com> (raw)

Hello!

I need to route traffic to specific port from localhost to specific gateway.

I'm testing this on icmp.

I wrote rules:

iptables -t mangle -A OUTPUT -p icmp -j MARK --set-mark 80
ip rule add prio 221 table 221 fwmark 80
ip route add default table 221 proto static  nexthop via 192.168.22.221 
dev eth0


Then I try to ping something from different subnet:

ping 10.1.1.1
connect: Network is unreachable


If I add rule
iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 80

Then I can successefully ping 10.1.1.1 from another host (my host is 
default gw for it, it's address is 192.168.22.229).

Hmmm.

How can I route marked packets from localhost?

ping 10.1.1.1
PING 10.1.1.1 (10.1.1.1) from 192.168.22.254 : 56(84) bytes of data.
 From 192.168.22.229: icmp_seq=1 Redirect Host(New nexthop: 192.168.22.221)




             reply	other threads:[~2004-07-21  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-21  9:03 Dmitry Melekhov [this message]
2004-07-22 10:09 ` iptables -A OUTPUT --set-mark , routing George Alexandru Dragoi

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=40FE316C.50109@belkam.com \
    --to=dm@belkam.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox