You are not logged in.
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
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
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
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
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
The host has to be on the same physical link for it to work. Is this the case?
Offline
Gateway which I want use as default gateway is behind vpn server.
Offline
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
Ok, thanks.
I thought that maybe some recursion and auto resolution can be in place .
Offline