# Issues configuring FreeBSD as a router



## MrDmi (Jul 14, 2010)

Greetings,

I'm attempting to use FreeBSD as a router between a virtual network (192.168.0.0), and my physical network (10.8.8.0).

I've several virtualbox machines running various versions of Windows, all using 192.168.0.0/255.255.255.0. They can perform dns lookups against the FreeBSD machine, but cannot access the internet.

They have a gateway of 192.168.0.10.

The FreeBSD install has 2 interfaces, one for the external, one for the internal. I've tried adjusting the routing in a way to allow for communication between the two networks and have failed over and over.

Can anyone point out what I need, or what I'm doing wrong? 


rc.conf:

```
hostname="lab10.local"
defaultrouter="10.8.8.1"
gateway_enable="YES"
sshd_enable="YES"
ifconfig_em0="inet 10.8.8.10 netmask 255.255.255.0"
ifconfig_em1="inet 192.168.0.10 netmask 255.255.255.0"
named_enable="YES"
natd_enable="YES"
natd_interface="em0"
natd_flags=""
```

resolv.conf

```
nameserver 10.8.8.1
```

netstat -rn

```
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            10.8.8.1           UGS         0        0    em0
10.8.8.0/24        link#1             UC          0        0    em0
10.8.8.1           00:1d:7e:61:3f:7d  UHLW        2       12    em0   1190
127.0.0.1          127.0.0.1          UH          0        0    lo0
192.168.0.0/24     link#2             UC          0        0    em1
```


----------



## SirDice (Jul 14, 2010)

Strictly speaking you probably don't need NAT. As long as you set up routing correctly. Most notably the router at 10.8.8.1 would need a route to 192.168.0.0/24.

But if you do want/need NAT the mistake is most likely there. Run tcpdump(1) on the em0 interface and try to access something on one of the 192.168.0.0/24 clients.


----------



## MrDmi (Jul 14, 2010)

That was it, I added the route to 192.168.0.0/24 to the external router and all works as desired.

Thanks for the help!


----------

