# Default source from gateway machine



## Anonymous (Jul 15, 2012)

I have a little problem here.
My gateway for my network can't use certain services because the external interface uses a private address. While one of the internal ones have the public address I want it to use as the source.

The thing is that I have multiple vlan's behind the machine which all use public addresses and the external interface have a private ip between me and my ISP's router.

Is there any solution to this by using pf route-to or such?

Int: 1.2.3.1
Ext: 192.168.10.25
Default gw: 192.168.10.1


----------



## ecazamir (Jul 22, 2012)

use NAT on the external interface.

```
no nat on $ext_if from ($ext_if:0) inet from 192.168.10.25 to 192.168.10.0/24
# It may work this way too, possibly more 'portable'
# no nat on $ext_if from (ext_if:0) proto icmp from (ext_if:network) to (ext_if:network)
nat on $ext_if from ($ext_if) -> ($ext_if:0)
```


----------



## Anonymous (Jul 30, 2012)

Got this to work.

```
no nat on $ext_if inet from 192.168.10.25 to 192.168.10.0/24
nat on $ext_if from ($ext_if) to any -> ($ext_public_if)
```

The result is that everything going from the gateway to anything not directly connected.
Would be NAT'ed via *$ext_public_if*. Which is the interface on the "inside" with the public IP address I wanted to use.


----------

