LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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: Seattle
Distribution: OpenBSD, Ubuntu
Posts: 60

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
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,184

Rep: Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765Reputation: 1765
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, Debian, Ubuntu
Posts: 13

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



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

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration