0

I have 2 routers, the main router`s gateway (from my ISP) is 192.168.1.1, the second router (a netgear R7000 with VPN configured) has 192.168.2.1 as gateway.

My centos 7 machine is connected via ethernet through a switch to the main router but he is quite far from the VPN router (the second router), is there a way how to re-route the connection from the centos machine to the second router so that I can use the VPN connection?

As a noob, I tried to change the machine IP address in the settings form 192.168.1.100 to 192.168.2.100 and the gateway to 192.168.2.1 but it is obviously not that simple :) as I have got no connection after that.

EDIT : A bit more details : I have 2 routers, router 1 : gw 192.168.1.1 with subnet 255.255.255.0 located at the first floor as the DSL line from my ISP comes from the first floor.

This router has 2 eth cables connected to its eth ports, the first cable goes downstairs to the ground floor to a switch. The switch connects the centos machine and an IP webcam. The second cable goes upstairs to the second floor to another switch and the router 2 is connected to it (the netgear) from the switch to the WAN port. The netgear has the gw 192.168.2.1 and subnet 255.255.255.0.

Two other computers are connected via cable to this switch on the second floor included an AP to extend the wifi signal for mobile phones and tablets.

What I would like to happen is : I configured a VPN on the netgear and I want also the centos7 from the ground floor to be connected to the VPN router located at the second floor. I hope this is clear enough :)

enter image description here

4
  • What do you mean "quite far from the VPN router"? What is the exact network setup you have? It is unclear what is the physical connectivity between your different devices. Commented Dec 18, 2016 at 12:02
  • With that I mean the distance between the centos7 and the 2nd router. The centos is on the ground floor and the VPN router is on the 2nd floor. Otherwise I would have simply connect it to one of the eth ports of the second router. The physical connectivity is very simple : Centos -> switch -> main router From the main router there is a cable going to the second floor to another switch and the VPN router connected to it.
    – rf2632
    Commented Dec 18, 2016 at 12:13
  • Your question is unclear, write/describe your network diagram (with ip/mask/gateway for all hosts, use clear names like: centos.eth0, router0.eth0, router1.eth1, router1.eth1.vlan4, WAN) Commented Dec 18, 2016 at 13:24
  • See my original post edited with more details :)
    – rf2632
    Commented Dec 18, 2016 at 14:40

2 Answers 2

1

This will work if the 192.168.1.1 router knows how to get the the networks on the other side of the 192.168.2.1 router, and vice versa.

Routers learn about routes in three ways:

  1. Directly connected networks
  2. Statically configured routes
  3. Through routing protocols

Every router knows about the networks that are directly connected to them, but they need to be told about networks that are not directly connect to them. You could statically configure the routes on the other side of the other router, but statically configured routes don't scale. The proper solution is to run a routing protocol between the routers.

11
  • Just to expand somewhat on the last sentence, the routing protocol in this context would be some IGP, for instance OSPF. Commented Dec 18, 2016 at 17:50
  • Yes, but probably RIP for the consumer-grade routers.
    – Ron Maupin
    Commented Dec 18, 2016 at 17:51
  • Thank you for your answers. As I said I am a newbie, can you please tell me in details what I should do? what router I need to configure and how? Thanks :)
    – rf2632
    Commented Dec 18, 2016 at 19:26
  • You will need to enable a common routing protocol on both routers. Your routers probably support RIP. You need to first make sure each router can communicate with the other router.
    – Ron Maupin
    Commented Dec 18, 2016 at 19:28
  • You still speak chinese for my knowledge so far :) What I can tell you is that the main router (192.168.1.1) is an Arcadyan VGV7519 and the second router (192.168.2.1) is a Netgear R7000 flashed with dd-wrt.
    – rf2632
    Commented Dec 18, 2016 at 21:42
0

Yours is easy ... in DHCP, dole out addresses with subnet mask of 255.255.252.0 ... see rfc1219 for more info.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .