Adding 2nd network route

Discussion in 'Linux Networking' started by herbert.burnswell, Dec 12, 2012.

  1. Hi All,

    I've been reading about how to add a 2nd network connection on a different subnet but haven't been able to get it to work.

    I have a virtual machine (v-sphere 5.1) running RHEL 6.3 with the following set-up:

    # cat /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE="eth0"
    ONBOOT="yes"
    BOOTPROTO=none
    NETMASK=255.255.254.0
    IPADDR=10.10.11.8

    # cat /etc/sysconfig/network
    NETWORKING=yes
    NETWORKING_IPV6=no
    HOSTNAME=host.domain
    GATEWAY=10.10.10.1

    # route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.10.10.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
    0.0.0.0 10.10.10.1 0.0.0.0 UG 0 0 0 eth0

    With the above set-up I can ping/communicate with any 10.10.10.0/23 system or any 10.10.12.0/23 system.

    I add the 2nd interface:

    # cat /etc/sysconfig/network-scripts/ifcfg-eth1
    DEVICE="eth1"
    ONBOOT="yes"
    BOOTPROTO=none
    NETMASK=255.255.254.0
    IPADDR=10.10.13.250

    # cat /etc/sysconfig/network-scripts/route-eth1
    10.10.12.0/23 via 10.10.12.1 dev eth1

    # /etc/init.d/network restart
    Shutting down interface eth0: [ OK ]
    Shutting down loopback interface: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: [ OK ]
    Bringing up interface eth1: RTNETLINK answers: File exists
    [ OK ]

    # route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.10.12.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
    10.10.10.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
    0.0.0.0 10.10.10.1 0.0.0.0 UG 0 0 0 eth0

    After adding eth1, I can communicate with any 10.10.10.0/23 system but cannot commuicate with any 10.10.12.0/23 system.

    Hopefully I am making a simple mistake and need to just tweak the set-up a bit to get it to work. Any guidance is greatly appreciated.

    Thanks in advance,

    Herb
     
    herbert.burnswell, Dec 12, 2012
    #1
    1. Advertisements

  2. Hello,

    a écrit :
    Your lines are too long.
    There is no specific route to 10.10.12.0/23, so I suppose this network
    is reached through the default gateway 10.10.10.1.
    This route does not make any sense. The gateway belongs to the
    destination network ! Either the network is directly attached and there
    is no need to provide a gateway, or the network is not directly attached
    and you must provide a gateway which is on a directly attached network.
    The nonsensical route is absent.
    IIUC, you could communicate with 10.10.12.0/23 before (trough gateway
    10.10.10.1 on eth0), but not after (directly on eth1) ?
    What is eth1 connected to ?
     
    Pascal Hambourg, Dec 12, 2012
    #2
    1. Advertisements

  3. Thank you for your reply.
    I'm not sure what you mean.

    Yes, both reached through default gateway.


    The nonsensical route is absent.

    Yes, that is correct.

    I'm not sure what you are referring to.

    My goal, which I though was simple, is to add eth1 with the 10.10.13.250 IP address. However as soon as I add it, I can no longer communicate with any 10.10.12.0/23 systems.

    If there are no glaring mistakes in what I have presented above then this leads me to believe that the problem may be a routing issue outside of this system.

    Thoughts?

    Thanks again,

    Herb
     
    herbert.burnswell, Dec 13, 2012
    #3
  4. herbert.burnswell

    Tauno Voipio Guest

    Nor am I sure what I need to put in the file.
    This is a perfectly valid question. If I may guess, you're running
    a virtual machine and adding an interface (eth1) that is not
    connected to anything at the host side.
    However as soon as I add it, I can no longer communicate with any
    10.10.12.0/23 systems.

    If you want to set an extra IP address to the existing virtual
    interface, use the Ethernet alias mechanism:

    ifconfig eth0:0 10.10.13.250/23
     
    Tauno Voipio, Dec 13, 2012
    #4
  5. You need to wrap them at 70 or so columns.
    You’ve left out a lot of details about your configuration. At a guess
    (which could be wrong) you have the guest’s eth0 bridged with the host’s
    network adapter which is attached to the same network as 10.10.10.1,
    which evidently can reach 10.10.12.0/23 somehow. What you’ve not stated
    how the guest’s eth1 is configured at all, nor why you think it might be
    able to reached 10.10.12.0/23, nor why you think the extra interface is
    even necessary in the first place (indeed the initial description
    suggests that it’s completely unnecessary and you’re just making work
    for yourself).
     
    Richard Kettlewell, Dec 13, 2012
    #5
  6. a écrit :
    No. The route to 10.10.10.1/23 has no gateway, meaning that destination
    is reachable on the network directly attached to the interface.
    A network interface must be connected to a network, otherwise it is useless.
    That is not a goal but a means to achieve some goal. What is the real
    goal, i.e. why you do want to add eth1 with address 10.10.13.250 ?
     
    Pascal Hambourg, Dec 13, 2012
    #6
  7. herbert.burnswell

    Gordon Guest

    They are over 80 characters long. Set your word wrap at 72 to 80 characters.
    Then the lines will be able to be read by all, easily.
     
    Gordon, Dec 19, 2012
    #7
  8. herbert.burnswell

    Aragorn Guest

    Google Groups does not allow one to do that, Gordon. And even if it
    did, its users wouldn't know about Usenet netiquette, since they are
    firmly and rigidly convinced that Usenet is a web-based forum run by
    Google. :p
     
    Aragorn, Dec 19, 2012
    #8
  9. Newsgroups: comp.os.linux.networking

    On Wed, 19 Dec 2012 07:52:39 +0100,

    Gordon> They are over 80 characters long. Set your word wrap at 72 to 80
    Gordon> characters. Then the lines will be able to be read by all,
    Gordon> easily.

    Aragorn> Google Groups does not allow one to do that, Gordon. And even
    Aragorn> if it did, its users wouldn't know about Usenet netiquette,
    Aragorn> since they are firmly and rigidly convinced that Usenet is a
    Aragorn> web-based forum run by Google. :p

    But you can always:

    1. use an extension like ItsAllText, or

    2. edit your post in a decent text editor (which allows
    filling/wrapping) and paste it into the webby input field.

    Of course that doesn't help with the second hurdle ;-)

    --
    Ian Zimmerman
    gpg public key: 1024D/C6FF61AD
    fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD
    http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png
    Rule 420: All persons more than eight miles high to leave the court.
     
    Ian Zimmerman, Dec 19, 2012
    #9
  10. Aragorn wrote:
    [...]
    What ?
    No embedded images, no (gr)Avatars ?
    No links that open in div/iframes?


    How archaic :p

    -rasp
     
    Ralph Spitzner, Dec 19, 2012
    #10
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.