2

I have a network where I have the host A, the host B (both Linux) and the gateway C. I am trying to reach the host Z.

The traffic, by default does:

A -> C -> Z

For some internal needs, I need the traffic to do:

A -> B -> C -> Z

In order to do so, I just add a route. So in A I execute something like:

route add A gw B

if I ping, I can see how the traffic does:

A -> B -> C -> Z

Which is good. However, as the time progresses, you can see how it comes back to (checked with mtr)

A -> C -> Z

and the routing table stills existing (route -n)

Any ideas to solve this issue ?

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Tk421
  • 230
  • 1
  • 8
  • Does B become unavailable at any point in time? Are getting an [ICMP redirects](http://en.wikipedia.org/wiki/ICMP_Redirect_Message) from B? – Zoredache Aug 24 '12 at 00:18
  • Did you try setting B as default route with _route add A default gw B_ ? I think it may have something in common of mac addresses in common network segment. Moreover it may have something in common with ICMP redirects (is B a windows machine ? ?:) ) – wojciechz Aug 24 '12 at 00:20
  • It sounds like `B` is sending inappropriate ICMP redirects. – David Schwartz Aug 24 '12 at 00:29
  • Mac address are different, but I will check the ICMP redirects. – Tk421 Aug 24 '12 at 03:40
  • Following (this post)[http://linuxpoison.blogspot.com.au/2010/01/how-to-disable-icmp-redirects-in-linux.html] I disabled to accept ICMP redirects and same results. This is virtualized host based using Xen. Might it have anything to do ? – Tk421 Aug 24 '12 at 03:44
  • Can you post the /etc/network/interfaces file (or where the interfaces are defined in your distro) as well as ifconfig for the relevant interfaces on A and B? What is router C? – Ed King Sep 27 '12 at 13:31

1 Answers1

0

If this is what you have Current

And this is what you want Desired

On A, you need to set B as your default gateway; via /etc/sysconfig/network-scripts/ifcfg-eht0 or /etc/sysconfig/network

This way, on reboot, the settings don't get lost.

On C, you should configure a static route for A to go through B. Not always necessary, but consistent if you want B to route all A's traffic to Z and vice versa.

Note if you build static routes on the boxes, you may need to write scripts to load on boot-up to re-add the routes. If you added the default gateway via terminal instead of the network-scripts, then this would be a good place to put the commands, so the default gateway gets readded on boot-up.

CIA
  • 1,604
  • 2
  • 13
  • 32