You are not logged in.

#1 2015-02-24 13:29:27

kubco2
Member
Registered: 2013-10-14
Posts: 24

Use gateway located outside LAN

Hello,

is possible to use non local gateway instead LAN?

I have more gateways available outside of local network and I want to be able to set default route to some of these gateways.
Simple route command answers "RTNETLINK answers: Network is unreachable".

I think basic routing doesnt allow this, because I must route over local gateway, but maybe some extensions are capable to do that.

It is not possible to redirect gateways on all hops to desired gateway. And I dont want set vpn server on all gateways.

Thanks for answer.

Jakub

Last edited by kubco2 (2015-02-24 13:31:51)

Offline

#2 2015-02-24 13:49:00

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: Use gateway located outside LAN

Could you be more specific - any example what is non-local gateway for you and how you expect use it instead of LAN?


Lenovo G50 | LXQT-git | compton | conky

Offline

#3 2015-02-27 09:24:35

kubco2
Member
Registered: 2013-10-14
Posts: 24

Re: Use gateway located outside LAN

LAN PC 192.168.1.10 ---->

LAN GW 192.168.1.1 ----> internet
LAN GW 192.168.1.1 ----> VPN 10.1.1.1
VPN GW server 10.1.1.1, 10.2.2.1/24 ----> internet1
GW in LAN of VPN server 10.2.2.2 ----> internet2
GW in LAN of VPN server 10.2.2.3 ----> internet3
GW in LAN of VPN server 10.2.2.4 ----> internet4

Some GWs are further than 2 networks.

One possible option is to deploy vpn on all GWs and from PC dial chosen VPN service.

I would like to specify gateway to internet from my pc without deploying vpn.
And without changing default gateway in all hops on the path to chosen gateway because it affects all connected devices.

Is it possible with some advanced networking/routing?
Does exist easier way then I wrote?

Last edited by kubco2 (2015-02-27 09:27:03)

Offline

#4 2015-03-05 14:30:01

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Use gateway located outside LAN

You need to create a host route to the gateway on a specific interface, like so:

route add -host 10.2.2.2 dev eth0

Offline

#5 2015-03-13 19:05:56

kubco2
Member
Registered: 2013-10-14
Posts: 24

Re: Use gateway located outside LAN

route add -host 10.200.1.2 dev wlan0

ip r

default via 192.168.1.1 dev wlan0  proto static  metric 600 
10.200.1.2 dev wlan0  scope link 
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.5  metric 600 

ping 10.200.1.2

PING 10.200.1.2 (10.200.1.2) 56(84) bytes of data.
From 192.168.1.5 icmp_seq=1 Destination Host Unreachable

ip r del 10.200.1.2 dev wlan0

ip r add 10.200.1.2 via 192.168.1.1

ip r

default via 192.168.1.1 dev wlan0  proto static  metric 600 
10.200.1.2 via 192.168.1.1 dev wlan0 
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.5  metric 600 

ping 10.200.1.2

PING 10.200.1.2 (10.200.1.2) 56(84) bytes of data.
64 bytes from 10.200.1.2: icmp_seq=1 ttl=62 time=1148 ms

sudo ip r add default via 10.200.1.2

RTNETLINK answers: Network is unreachable

Or how do you mean it? Maybe I dont understand.

Last edited by kubco2 (2015-03-13 19:06:45)

Offline

#6 2015-03-14 01:08:20

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Use gateway located outside LAN

The host has to be on the same physical link for it to work. Is this the case?

Offline

#7 2015-03-17 16:38:07

kubco2
Member
Registered: 2013-10-14
Posts: 24

Re: Use gateway located outside LAN

Gateway which I want use as default gateway is behind vpn server.

Offline

#8 2015-03-18 09:24:06

Zeddi
Member
From: Germany near Bremen
Registered: 2009-08-30
Posts: 30

Re: Use gateway located outside LAN

No, if the PC is not on the same subnet as the gateway it will not work.

You can't go through the main door of the house, if you are in a room hat is not connected directly to the main door of the house. You must first pass the room-doors that connects your room to the main-house door.


I'm not very used to write English since i've left School, so please be patient!

Offline

#9 2015-03-18 21:05:20

kubco2
Member
Registered: 2013-10-14
Posts: 24

Re: Use gateway located outside LAN

Ok, thanks.

I thought that maybe some recursion and auto resolution can be in place smile.

Offline

Board footer

Powered by FluxBB