# Public address routing



## schmurfy (Nov 25, 2013)

Hi,

I am trying to figure out how to configure my freebsd FreeBSD VM (it could be a physical host, the type does not matter here), we have a pretty straightforward topology with one router connected to the internet on one interface and on our server network on another interface. Now on the Linux servers what we do is set[]up a local DHCP address on a private network and then route a /32 public address to this server with the router.

On Linux this is done by this:


```
ip link add dummy0 type dummy
ip address add <public_address>/32 dev dummy0
ip route add default via <private_lan_gateway> src <public_address>
```

(<private_lan_gateway> is the main router address on the private network)

*T*his allows the VM to be reachable from the outside and allow it to access the outside but only requires 1 address instead of a /30 network. Now my problem is to translate the same thing on FreeBSD, since you cannot force the outgoing address on a route I am short of ideas on how to do that.

I tried using packet filter to NAT the address when speaking to anything but the local network, this works but only for packets coming from the outside, the rule do not NAT the packets produced by the server itself.

Please tell me there a simple solution for that and I just didn't look in the right direction.

PS: I have only limited control over the main router so I prefer not having to do any NAT on it.


----------



## johnblue (Nov 29, 2013)

I did not spend too much time thinking about this but it sounds like what you want is a bridge.

http://www.freebsd.org/doc/handbook/net ... dging.html


----------

