tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NAT with public interface with more than one address



Hi,

It seems there are no more search engines which allow for searching for exact things. "npf" "nat" "multiple addresses" nets nothing, nor does +npf +nat +"multiple addresses". I feel like search engines are not very useful these days.

I'm so confused. Here's simple NAT with npf:

$ext_if = re0
$ext_ip = { inet4($ext_if) }
$localnet_lan = { 192.168.50.0/24 }
map $ext_if dynamic $localnet_lan -> $ext_if

Ok. But what happens when re0 has more than one address?

/etc/npf.conf:17:0: map segment cannot have multiple static addresses

How about:

$ext_ip = 47.150.85.30
or
$ext_ip = { 47.150.85.30 }

/etc/npf.conf:25:27: wrong variable 'ext_ip' type 'family-address-mask' for interface near '$ext_ip'

Nope. What about:

$ext_ip = 47.150.85.30/32
$ext_ip = { 47.150.85.30/32 }
/etc/npf.conf:15:0: translation address, given the specified algorithm, must be a pool or a single address

So what does inet4(interface) look like? The man page says, "Static list. IPv4 addresses." Not sure, but I see this in the examples:

map $ext_if dynamic $localnet_lan -> ifaddrs($ext_if)

Using ifaddrs(), either with the interface or with inet4(interface), gives me NAT with as many IPs as the interface has without the errors above, but I can't control which address NAT uses.

But I can't use $ext_ip when it is set to 47.150.85.30, even though I can just put 47.150.85.30 in place of $ext_ip.

I'm completely missing something here. Can someone please help?

Thanks,
John Klos


Home | Main Index | Thread Index | Old Index