0

From my point of view, there's no way of doing this, but maybe someone can suggest me a workaround.

I have two companies that have a VPN between them, configured on a Mikrotik router. Subnets 192.168.1.0/24 and 192.168.2.0/24 and they are working fine.

I had to create a DHCP server(192.168.2.240) on my N2 company. I kinda have a small different subnet inside the company.

What I need is that when this "different subnet" goes to the internet, they pass through the firewall on my N1 company(192.168.1.10).

I created the routing table on my N2 company, but when I try to put the gateway for this routing table, I have the error:

ip route add table othernet default via 192.168.1.10  metric 100
RTNETLINK answers: Network is unreachable

That is very natural, since this DHCP server is not on the same subnet, but there is a way of doing something like this?

I know that if I configure a VPN directly between these two hosts(002-DHCP,001-Firewall) I can make this happen, but I would like to do it only with routes configured on these both Linux.

Eric Renouf
  • 939
  • 8
  • 19
  • Possible duplicate of [Setting a default gateway which is on a different subnet](https://serverfault.com/questions/686451/setting-a-default-gateway-which-is-on-a-different-subnet) – Eric Renouf Jul 18 '17 at 16:05

1 Answers1

0

Your question is broken. You said that you have a router on each end of the VPN connection between the two sites. The router at site two should be configured to point to the router at site one for its default gateway. The DHCP server should be configured to point to the router for the gateway also. If you have the router configured properly, traffic should flow and it should not matter what operating system you have and there should not need to be any static configuration in the computer. Something isn't right either in your question or your hardware configuration.

  • Ok, I probably didn't explain correctly. The routes between then are OK. From my DHCP server(on N2) I can ping and connect firewall and every host from N2. But (I'll use fictional IP for explanation)...in my N1 Company I have IP 200.150.140.101, and in my N2 Company I have the IP 199.198.197.102. I want to have a static route on my DHCP server(N2), so that when I go to the internet, I use the IP 200.150.140.101(N1). In other words,I don't want to connect the firewall, I want to pass through it until the internet. The other hosts on N2 still must go to the internet with 199.198.197.102(N2). – Carlos Parisotto Jul 18 '17 at 16:53
  • The system that you want to send their traffic to a host on N1, set that system to have the host on N1 as the gateway address. It will force any traffic to a non local address to go to that host to be routed. – Chris Moore Jul 18 '17 at 17:00
  • I don't know if I understood you right. But you're saying to me set up a host on N1 as a gateway for a host on N2, right? Then, that happens: COMMAND: ip route add table othernet default via 192.168.1.10 metric 100 RETURN: RTNETLINK answers: Network is unreachable – Carlos Parisotto Jul 18 '17 at 17:28