Find the answer to your Linux question:
Results 1 to 7 of 7
Hi all, I am trying to play around with routing and I have a symptom I do not quite understand. Background - A private network addressed 10.100.100.0/24. - router1 - ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    6

    Changing default route issues


    Hi all,

    I am trying to play around with routing and I have a symptom I do not quite understand.

    Background
    - A private network addressed 10.100.100.0/24.
    - router1 - This router is the default gateway sits on the network as 10.100.100.1. This machine also provides dhcp leases, dns and basic network services. It is directly connected to the internet via a second nic and iptables is used to nat the connection and provide internet connectivity to the network.
    - router2 - This sits on the network at 10.100.100.2. This is also connected to the internet via a second ISP via an off the shelf router. Also has the ability to nat connections out to the internet via iptables and the off the shelf router.

    Task
    I am connected to a third machine on the network (10.100.100.3 for arguments sake). The default route for the machine is 10.100.100.1. I have a small script that goes to the internet (wget) and grabs the external IP from ipogre.com/linux.php.

    I run the test first time and get the external IP associate with the external nic on router1 as I expect. All good so far.

    Next I manually delete the default gateway 10.100.100.1 on the client and add the new default gateway 10.100.100.2. Route shows me the new gateway as I expect. I run my script again and I once again get the external IP associated with router1 and not that of router2.
    If I run a traceroute to yahoo.com for example, the route is shown via router2.

    Can anyone try to help me understand why changing the default gw on the client is not reflected in the wget command yet is in the traceroute?
    I don't profess to be a networking expert of any calibre so apologies if this is a stupid question.

    Many thanks.

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,672
    Are you sure the first test results are not cached some where? What about your ARP table does it also get flushed?

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Aug 2012
    Posts
    15
    And is your script IP based or URL based? If it's URL it will always point back to the designated IP in a name-server out there.

  4. #4
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    You might check out this page: Tuning Linux IPv4 route cache | Vincent Bernat.

    In particular, checkout the output of the "ip route show cache" command.

    N

  5. #5
    Just Joined!
    Join Date
    Sep 2012
    Posts
    6
    Thanks all for the pointers.
    @Lazydog - I did not flush the ARP tables. I will do some reading and try that next time.
    @gregr1969 - The script is using the URL for the IP service
    @nplusplus - I will have a read of that page

    I am away from the network for the next couple of weeks so it might take a while before I get to troubleshoot this any further.

  6. #6
    Just Joined!
    Join Date
    Aug 2012
    Posts
    15
    then that would explain your problem. DNS records point to a static IP unless they are dynamically assigned. You would need static routes to change the way it traces and your script would have to be based on IP NOT URL as URL uses DNS entries

  7. #7
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    29
    This to me sounds like you have a proxy server in the network and its default route is via 10.100.100.1. If both 10.100.100.1 and 10.100.100.2 are setup to do transparent proxying, or the client is configured to always use a proxy server, then changing the default gateway on the client will only affect non-proxy traffic!

    Cheers,
    tkb.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •