# Lost in routing



## corrosion (Dec 28, 2012)

Hello all,

I've been trying for hours and don't know how to continue.
I have a FreeBSD server that for a while I need to act as a gateway. It haves two NICs on different and sepparated networks: 172.26.0.0 and 192.168.0.0
And I need two things.
The first is act as a gateway so from the 172.26.0.0 network I can access the 192.168.0.0 network and vice-versa. I can do it from the server, but not from any host that uses the FreeBSD as the gateway.
The second is that, for a while, internet access will only be from the 192.168.0.1 dsl router. So, as my FreeBSD machine can use it, I want all my 172.26.0.0 network be able to use the 192.168.0.1 router from my FreeBSD server.
I have been reading and trying with no success. Any help?
This FreeBSD server is 9.0 version.
This is the route -nr:


```
$ netstat -nr
Routing tables
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.0.1        UGS         0    53752  wlan0
127.0.0.1          link#9             UH          0       99    lo0
172.26.0.0/24      link#8             U           0      273    rl0
172.26.0.22        link#8             UHS         0        0    lo0
192.168.0.0/24     link#10            U           0        1  wlan0
192.168.0.22       link#10            UHS         0        0    lo0
```

Many thanks and regards,


----------



## bbzz (Dec 29, 2012)

The hosts in 172.26.0.0/24 should have default route pointing to 172.26.0.22. This way they reach everything. Hosts in 192.168.0.0/24 have default route pointing to 192.168.0.1, your dsl router. In orded to reach hosts in 172.26.0.0/24 they need to point to 192.168.0.22.

In addition, your dls router at 192.168.0.1 must know how to reach 172.26.0.0/24 network. Or, you could make FreeBSD run NAT so 172.26.0.0/24 gets changed to 192.168.0.22. 

Does that makes sense?


----------

