# Two routers in one network



## Nokobon (May 15, 2009)

Hello,
I have a general network problem. Although it isn't a problem directly related to FreeBSD I hope you'll give me some helpful advice.

I have a small network with two clients connected to the internet over one router that uses DHCP.
Now I'd like to connect another router to it with two more mashines (one of them is a FreeBSD-Server) which also need access to the internet.

Is this possible?
How do I realise this?
I'm not sure how to configure the second router (i.e. DHCP?)...

I hope you understand what I mean, since my English is not that good.
Furthermore I'm not sure if I have offered enough information. If not, tell me what else you need to know.

Thank you,
Nokobon


----------



## vivek (May 15, 2009)

Do you need to route traffic using different network? For e.g, em0 connected to VPN and em1 connected to the Internet. In that case use static routing configuration. For e.g. em0, vpn static routing to route network traffic 192.168.1.0/24  via 192.168.1.254:

```
static_routes="lan"
route_lan="-net 192.168.1.0/24 192.168.1.254"
```
Use the following to set default router for the Internet:

```
defaultrouter="1.2.3.4"
```
All config must be added to /etc/rc.conf. Or use sysinstall to configure it.


----------



## icer (May 15, 2009)

why you can't connect your PCs directly to first router? Ore your have tow routers that connect to different ISP?
Smf like that:

```
----
          ----      dhcp lan!  !dhcp provaider
clients---!  !--------------!  !------------
          ----              !  !
         swith              ----
```


----------



## Nokobon (May 15, 2009)

Thanks for your suggestions so far...



			
				vivek said:
			
		

> Do you need to route traffic using different network? For e.g, em0 connected to VPN and em1 connected to the Internet. In that case use static routing configuration. For e.g. em0, vpn static routing to route network traffic 192.168.1.0/24  via 192.168.1.254:
> 
> ```
> static_routes="lan"
> ...


Well, sorry I'm new to networking so I don't really understand everything you explained...
But as far as I know, I don't need that.

By the way, the router I'd like to add is a D-Link AirPluse G+ Wireless Router (I don't need the W-LAN).
It can be configured with a Configuration-Menu in a webbrowser.
Isn't the configurationn that can be done there enough?



			
				icer said:
			
		

> why you can't connect your PCs directly to first router? Ore your have tow routers that connect to different ISP?
> Smf like that:
> 
> ```
> ...


I can't connect these two PC's directly to the first route because of areal reasons.
They are in a room with only one connection to the first router.
To install a second cable between the router and that room is too circuitous and wireless-lan also doesn't work because of the building.

And there is only one ISP. And as I said the first router is connected to it.


----------



## tingo (May 16, 2009)

It sounds to me like you want a switch, not a second router.


----------



## Nokobon (May 17, 2009)

tingo said:
			
		

> It sounds to me like you want a switch, not a second router.



Yeah you are right, that became clear to me, too.

Since I don't have a switch, I have to use the second router as a switch.

So I connected the two computer to the second router as well as the connection to the first router (on a Lan-Port).
That worked well except for the computer directly connected to router 1.
They now used router 2 as DHCP (I have no idea why).
So I have to disable DHCP of the second router.
Furthermore I have to give router 2 an I IP in the address-range of router 1, to have access to it's configuration menu.

Now everything works!
All the mashines have access to the internet with router 1 as gateway and DHCP-server, while router 2 operates like a switch.


----------

