Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All, I need help! i'm with a problem and i didn't find a solution nowhere. In fact, i'm confused even how to find this my problem in the forums ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    2

    2 NICs on same subnet


    Hi All,

    I need help!
    i'm with a problem and i didn't find a solution nowhere. In fact, i'm confused even how to find this my problem in the forums for example.

    Well, i have a equipment with Linux Centos and 2ethernet ports. I enabled 2 ports, eth0 and eth1, and configured them with static ips (eth0 = 192.168.31.5 and eth1 = 192.168.31.9). Ok!

    If i plug 2 ethernet cables, one for each, i can to ping my equipment by 2 ips, 192.168.31.5 and 192.168.31.9. But, if i remove the cable from eth1, i still can to ping in these 2 ips. After of this i can to disable the eth1 and 2 ips still will be available for me in the eth0 port.

    I did a test, and if i configure the 2 ips in distinct subnets this problem doesn't occur.

    Right now, if i to plug the cable in eth1 will not do difference, just eth0 port is working.

    Someone know about this? Sorry,but my english is not so good...

    Thanks!

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,410
    It doesnt work that way.

    You need to create a "bond" device first, that consists of eth0 and eth1.
    Once you have that, you can then create aliases on it to have multipe IPs in the same network.

    http://www.kernel.org/doc/Documentat...ng/bonding.txt
    You must always face the curtain with a bow.

  3. #3
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    The reason you are able to ping 2 IPs regardless of if its plugged in may be a result of having forwarding enabled. With ip forwarding, even if the cable is unplugged to one NIC, the other will pass it through.
    linux user # 503963

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,410
    Yes, and packets are only routed to one interface.
    That explains the ping results.
    You must always face the curtain with a bow.

  6. #5
    Just Joined!
    Join Date
    Dec 2011
    Posts
    2
    The first thing: Thanks at all!

    For scathefire
    /etc/sysctl.conf:
    net.ipv4.ip_forward = 0
    It seems disabled.


    For Irithori
    Yes, i know bonding but i want know if this behavior is normal?

    There is a method for disable this behavior?
    Without bonding, I want that if I disconnect eth1 then i shouldn't ping 192.168.31.9!

  7. #6
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Does pinging still work when you do:

    Code:
    $ ifdown eth1
    and then unplug the cable from eth1?

Posting Permissions

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