View previous topic :: View next topic |
Author |
Message |
enkil Tux's lil' helper
Joined: 27 Apr 2004 Posts: 115 Location: Bern, Switzerland
|
Posted: Tue Dec 06, 2005 6:38 pm Post subject: Use custom routing to a far away network |
|
|
Okay, imagine the following scenario:
Code: | My box
|
|
GW A -- GW D -- GW E -- GW F -- GW G -- Host 2
|
|
GW B
|
|
GW C
|
|
Host 1 |
where GW A is my default gateway.
Now, I want to use the route from GW A -> GW D -> ... -> GW G to access Host 1 and not GW A -> GW B -> GW C which is the default route I get.
My idea was to manually add a route to GW G and set GW G as my gateway to Host 1.
Is this possible at all? I don't know how I would get routed from GW G to Host 1 (and I don't care, as long as I take the route over GW G).
I tried to add a route to GW G manually, starting with
Code: | route add -host "GW D" gw "GW A" |
and it worked without problems, until I'd reach the second gateway, GW E
Code: | route add -host "GW E" gw "GW D" |
gives me "Destination network unreachable". So, I specified a gateway that can reach GW E and I have a gateway that I can reach using my default gateway... Where's the problem with that? Do I have to reach gateways directly without any gateway in between? |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Tue Dec 06, 2005 8:48 pm Post subject: |
|
|
I don't get it. If host1 is physically reachable through either route it needs two IP addresses, one in a subnet with GW G and another one in a subnet with GW C, meaning there should be no problem at all!?
Besides, what is this host2 in your drawing? Rather unclear your setup. Could you be more specific, please.
Alex!!! _________________ ALT-F4 |
|
Back to top |
|
|
enkil Tux's lil' helper
Joined: 27 Apr 2004 Posts: 115 Location: Bern, Switzerland
|
Posted: Wed Dec 07, 2005 7:37 am Post subject: |
|
|
Okay, sorry if I wasn't clear enough . I drew a new picture and I'll rephrase it....
http://img202.imageshack.us/img202/4426/diagram17vh.jpg
All IP-Addresses are fictional. Now, where you see a dotted line, there are more gateways in between. I want to reach 213.213.213.213. When I use my ISP's default gateway (193.193.193.1), I take the blue path to reach 213.213.213.213. Now, the gateway at the end of the red path (182.182.182.1) is the way I want to go. I want to take the red path, reach 182.182.182.1 and continue on the green path to access my target host. The green path is unknown to me. So, my basic idea was to:
Code: | route add -host 170.170.170.1 gw 193.193.193.1 |
and
Code: | route add -host 171.171.171.1 gw 170.170.170.1 |
and so on, until I had defined a route to 182.182.182.1. If I'd be able to define this route, I want to
Code: | route add -host 213.213.213.213 gw 182.182.182.1 |
and in my naive understanding of this, my packets would take the red path to 182.182.182.1 and from there, they would use some path (the green one, which I don't exactly know) to finally reach my target.
So the idea is to avoid certain gateways on the blue path, because they are slow like hell. And now my questions: Is this possible at all, that if I define a route to the gateway 182.182.182.1, where 213.213.213.213 is not reachable from 182.182.182.1, and let 182.182.182.1 route me further until I reach my target, or if I have to know all gateways on the green path.
The next question was the following:
I was able to add a route to the first gateway on the red path
Code: | route add -host 170.170.170.1 gw 193.193.193.1 |
but when I want to add a route to the next gateway in the path
Code: | route add -host 171.171.171.1 gw 170.170.170.1 |
I get "Network unreachable" and I don't know why. Do I have to have a direct link to 170.170.170.1 to define it as a gateway in my routing-table, or is it somehow possible to use it although I'm only able to reach it via another gateway.
I hope this was specific enough... |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Wed Dec 07, 2005 8:32 am Post subject: |
|
|
Unless you can configure your ISP's router (which I doubt) this isn't possible.
You cannot define gateways that aren't on your subnet. So you always end up on your ISPs router which makes a routing decision you simply cannot control.
Those big routers normally do dynamic routing anyway. I.e. the routing decision is a function of paramaters such as availability, network load and others (I'm no expert on dynamic routing, but I think, you get the idea).
Hth, Alex!!! _________________ ALT-F4
Last edited by tuxmin on Wed Dec 07, 2005 4:05 pm; edited 1 time in total |
|
Back to top |
|
|
enkil Tux's lil' helper
Joined: 27 Apr 2004 Posts: 115 Location: Bern, Switzerland
|
Posted: Wed Dec 07, 2005 11:16 am Post subject: |
|
|
tuxmin wrote: | You cannot define gateways that aren't on your subnet. So you always end up on your ISPs router which makes a routing decision you simply cannot control. |
Well, that's unfortunate
But thanks for the answer! |
|
Back to top |
|
|
MrUlterior Guru
Joined: 22 Mar 2005 Posts: 511 Location: Switzerland
|
Posted: Wed Dec 07, 2005 2:49 pm Post subject: |
|
|
enkil wrote: | tuxmin wrote: | You cannot define gateways that aren't on your subnet. So you always end up on your ISPs router which makes a routing decision you simply cannot control. |
Well, that's unfortunate
But thanks for the answer! |
With perseverance and iproute2 what you want is achievable.
I'd use a VLAN or VPN (depending on the security of the network between the hosts) though personally. _________________
Misanthropy 2.0 - enough hate to go around
|
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Wed Dec 07, 2005 3:35 pm Post subject: |
|
|
Do you mind to explain how?
Regards, Alex!!! _________________ ALT-F4 |
|
Back to top |
|
|
MrUlterior Guru
Joined: 22 Mar 2005 Posts: 511 Location: Switzerland
|
Posted: Wed Dec 07, 2005 3:47 pm Post subject: |
|
|
tuxmin wrote: | You cannot define gateways that aren't on your subnet. So you always end up on your ISPs router which makes a routing decision you simply cannot control. |
After a bit of reading, this is not true. What it should say is:
You cannot define default gateways that aren't on your subnet.
You can easily add routes to YOUR DEFAULT GATEWAY providing methods to reach different subnets or hosts. _________________
Misanthropy 2.0 - enough hate to go around
|
|
Back to top |
|
|
nevynxxx Veteran
Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Wed Dec 07, 2005 3:50 pm Post subject: |
|
|
MrUlterior wrote: | I'd use a VLAN or VPN (depending on the security of the network between the hosts) though personally. |
Considering a VLAN is a way of splitting a subnet even further (notice how many subnets are involved here) I would think that is the wrong way about it, can VLANs even span subnets?
How would a VPN help? Data will be encrypted, but it will still take the same route normal data would, it will just be slower as the routers handle larger packets! _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Wed Dec 07, 2005 3:56 pm Post subject: |
|
|
MrUlterior wrote: | tuxmin wrote: | You cannot define gateways that aren't on your subnet. So you always end up on your ISPs router which makes a routing decision you simply cannot control. |
After a bit of reading, this is not true. What it should say is:
You cannot define default gateways that aren't on your subnet.
You can easily add routes to YOUR DEFAULT GATEWAY providing methods to reach different subnets or hosts. |
I don't agree, any gw must be on the host's subnet(s).
EDIT: Furthermore, there is no point in adding extra host or net routes when you only have one gateway (which naturally is your default gw).
Alex!!! _________________ ALT-F4 |
|
Back to top |
|
|
|