LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices

Reply
 
Search this Thread
Old 08-06-2012, 01:14 PM   #1
IMNOboist
Member
 
Registered: Nov 2003
Location: Northern Utah
Distribution: OpenBSD, Ubuntu, Linux Mint, Knoppix
Posts: 56

Rep: Reputation: 16
OpenBSD pf NAT question


I'm confused about how NAT is working. I currently have the following line:
match out on $ext_if from !(egress:network) to any nat-to $default_out

Which works. $default_out is one of the static IP addresses assigned to $ext_if.

However, I have certain systems that I want to go out of a different IP address (I have five statics). I tried this:
match out on $ext_if from 172.16.111.1 to any nat-to $static2

where $static2 is a different static address. After loading the ruleset, when I browse with 172.16.111.1, when I google "ip" it shows the address from $default_out.

I've tried adding the quick keyword to the $static2 NAT and moving it above the $default_out NAT but no beans.

Why isn't this working?

Is there another way I can NAT specific internal addresses to external addresses other than $default_out?

TIA
 
Old 08-10-2012, 09:08 AM   #2
gezley
Member
 
Registered: Sep 2009
Location: Ireland
Distribution: Slackware64, NetBSD
Posts: 490

Rep: Reputation: 207Reputation: 207Reputation: 207
Have you set up the second IP address as an alias on the interface?

http://www.openbsd.org/faq/faq6.html#Setup.aliases
 
Old 08-29-2012, 05:08 AM   #3
nickbeee
LQ Newbie
 
Registered: Aug 2012
Location: UK
Distribution: FreeBSD, NetBSD, OpenBSD, Fedora, CentOS
Posts: 9

Rep: Reputation: Disabled
Which version of OpenBSD are you using? Can you post your full pc.conf so we can see it in context?

You should find the OpenBSD FAQ section on NAT quite helpful.

Quote:
Originally Posted by IMNOboist View Post
I'm confused about how NAT is working. I currently have the following line:
match out on $ext_if from !(egress:network) to any nat-to $default_out

Which works. $default_out is one of the static IP addresses assigned to $ext_if.

However, I have certain systems that I want to go out of a different IP address (I have five statics). I tried this:
match out on $ext_if from 172.16.111.1 to any nat-to $static2

where $static2 is a different static address. After loading the ruleset, when I browse with 172.16.111.1, when I google "ip" it shows the address from $default_out.

I've tried adding the quick keyword to the $static2 NAT and moving it above the $default_out NAT but no beans.

Why isn't this working?
Not quite in the correct format - should be

Code:
pass out on tl0 from 192.168.1.0/24 to any nat-to 24.5.0.5
or to follow the FAQ recommendation replace the addresses with the interface names.

The above refers to NAT overload (or rather PAT - port address translation) though, many internal RFC1918
addresses sharing one external public ip address...
Quote:
Is there another way I can NAT specific internal addresses to external addresses other than $default_out?
Yes you need to be using static NAT. See the FAQ section on Bidirectional 1:1 mapping using the binat-to function.

HTH,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD 4.9 PF and NAT do not work lcxpics *BSD 5 09-20-2011 07:49 AM
NAT and NAT Server behind its own NAT(private network) zeusys Linux - Networking 1 06-08-2011 06:22 PM
Openbsd question regarding Laptop mykyl *BSD 8 01-07-2008 03:47 AM
[OpenBSD 3.9] NAT Configuration/ Static IP Slycer *BSD 4 05-16-2006 04:14 AM
localtime / date question with openBSD lazlow69 *BSD 6 12-14-2004 07:50 PM


All times are GMT -5. The time now is 09:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration