🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.openbsd-pf
Article #229

Source port translation only

#229
From: Nejc Škoberne
Date: Fri, 22 Jun 2012 16:09
29 lines
1720 bytes
Hi,

I want to do (stateful) source port translation (restriction actually) 
on my outgoing packets, but no source address translation. And I want to 
do it for IPv6.

So if there is a TCP packet like this:

SRC ADDR: 2001:db8::10
DST ADDR: 2001:c0de:
SRC PORT: 53523
DST PORT: 80

I want to translate it so that the source port falls into a specific 
port range, say [1024:2047]:

SRC ADDR: 2001:db8::10
DST ADDR: 2001:c0de:
SRC PORT: 1500
DST PORT: 80

If the source port is already in the requested port range, no 
translation is needed (but the state has to be kept anyway).

Is this possible to do with pf? If not, does anybody know for any other 
(simple) way to do it?

Thanks,
Nejc
Technical Details
Message-ID: <4FDF5464.6060501@skoberne.net>
Path: arc1-ca.pugleaf.net!e27ni77812bkw.0!nntp.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn

Show Full Headers
Complete Article Headers
X-Google-Thread: ff4ef,d7a2c3e258aabdfe,start
X-Google-NewGroupId: yes
X-Google-Attributes: gidbffa70e3,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.204.143.145 with SMTP id v17mr341193bku.7.1340381351937;
        Fri, 22 Jun 2012 09:09:11 -0700 (PDT)
Path: arc1-ca.pugleaf.net!e27ni77812bkw.0!nntp.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn
From: nejc@skoberne.net (Nejc Škoberne)
Newsgroups: bit.listserv.openbsd-pf
Subject: Source port translation only
Date: 22 Jun 2012 09:09:10 -0700
Organization: None
Lines: 29
Message-ID: <4FDF5464.6060501@skoberne.net>
NNTP-Posting-Host: [192.168.15.134]
Mime-Version: 1.0
NNTP-Posting-Date: 22 Jun 2012 16:09:10 GMT
X-Received-Bytes: 1279
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit