All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Taylor <gtaylor@riverviewtech.net>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: Change source port
Date: Mon, 26 Nov 2007 19:50:40 -0600	[thread overview]
Message-ID: <474B77F0.8080109@riverviewtech.net> (raw)
In-Reply-To: <1196115598.27273.1223346377@webmail.messagingengine.com>

On 11/26/2007 4:19 PM, netfilter@buglecreek.com wrote:
> We have a situation where our nameservers are contacting an upstream
> nameserver to resolve a name using a source port 53 and a destination
> port 53.  We have found out that the upstream name server will not honor
> our request since the source port from our nameservers is 53.  Until we
> can resolve this with the upstream admin, we would like
> change the source port from our name server to a high numbered port
> using iptables when it tries to contact the upstream nameserver.  We can
> not seem to put together a rule to do this.  Is it even possible?  

Refer to the IPTables man page for exact syntax, but yes you can change 
the source port if you SNAT the packets.

iptables -t nat -A POSTROUTING -o ${ExtIF} -p udp --sport 53 -j SNAT 
--to-source ${ExtIP}:${ExtPort}

iptables -t nat -A POSTROUTING -o ${ExtIF} -p tcp --sport 53 -j SNAT 
--to-source ${ExtIP}:${ExtPort}



Grant. . . .

  reply	other threads:[~2007-11-27  1:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 22:19 Change source port netfilter
2007-11-27  1:50 ` Grant Taylor [this message]
2007-11-27  9:21   ` G.W. Haywood

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=474B77F0.8080109@riverviewtech.net \
    --to=gtaylor@riverviewtech.net \
    --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.