# route problem



## polhallen (May 20, 2013)

Hi folks! I have this situation:


```
server1 - rl0 - 192.168.1.250 (and many pc on lan: 192.168.1.2, 192.168.1.3, ecc)
          rl1 - 192.168.2.250

server2 - rl0 - 192.168.2.52
```
on server1 I do:

`route add -net 192.168.2.0/24 192.168.2.250` and from server2 I can ping only 192.168.1.250 but not 192.168.1.1, 192.168.1.2, etc.

*W*here's the problem?

Thanks!


----------



## ShelLuser (May 20, 2013)

For starters; if server1 already has a network interface which can access the 192.168.2.0/24 network (using rl1 which has 192.168.2.250) then why would you need to add an extra route?

So on server*2* (not server1) you'd need to add a route indicating that it should sent data for 192.168.1.0/24 to server1 (so using 192.168.2.250 as gateway, something like `# route add -net 192.168.1.0/24 192.168.2.250`). Then you need to setup server1 to act as a gateway, for starters you'll need to add gateway_enable="yes" to the rc.conf(5) file.

I'd advice you to check out the gateways and routing section of the FreeBSD handbook, that will explain this process in full detail.


----------



## polhallen (May 20, 2013)

Hi, and thanks for your reply.

On server1 I already have: 
	
	



```
gateway_enable="yes"
```
 and `netstat -nr` is:


```
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.1.212      UGS         0       88    re0
127.0.0.1          link#8             UH          0        8    lo0
192.168.1.0/24     link#1             U           0      972    re0
192.168.1.250      link#1             UHS         0        0    lo0
192.168.2.0/24     link#7             U           0      526    xl0
192.168.2.250      link#7             UHS         0        0    lo0
```

*S*o, from server1 I can ping 192.168.2.0/24. On server2 I can see only 192.168.1.250. Also add the net like: `route add -net 192.168.1.0/24 192.168.2.250`. *F*rom server2 I can ping only 192.168.1.250. I already read the "gateways and routes" but I can't understand how to resolve.

*T*hanks!


----------



## usdmatt (May 20, 2013)

Are your client machines using `192.168.1.212` as their gateway, as *server1* is? What is that device?

If you've told *server2* it can access the 1 network via *server1*, packets are probably going from *server2* successfully. However, it the client machines are not using `1.250` as their gateway, they won't know how to send data back to the 2 network. They will be sending the packets to their default gateway.


----------



## polhallen (May 20, 2013)

192.168.1.212 is another server. From server1 I can go to the internet (by 192.168.1.212 and I can ping the  whole *LAN*: 192.168.1.0/24 and 192.168.2.0/24).

From server2 (`netstat -rn`):

```
default            192.168.2.250      UGS         0     7834   fxp0
127.0.0.1          link#8             UH          0        0    lo0
192.168.2.52       link#6             UHS         0        0    lo0
```
I can see 192.168.2.0/24 and only 192.168.1.250 but not 192.168.1.212 and other clients. Your rule doesn't work.


----------



## usdmatt (May 21, 2013)

I don't know whether you meant me or @ShelLuser but please don't write blunt statements like "Your rule doesn't work". We come here to try and help people, no-one is paid to provide support and it's not our fault you're trying to set up a fairly awkward network design with no knowledge of how to configure or troubleshoot it properly.

What is the default gateway on the rest of the clients on the 1. network, and what is the default gateway on 1.212?

I suspect 1.250 is the only machine on the 1. network that actually knows how to deliver packets back to the 2. network (which is why it's the only one your can see). It's difficult to provide a definitive answer when we don't know the full layout/configuration of your network.


----------

