Binding a single IP Address to two different MAC addresses

Discussion in 'Linux Networking' started by Ramesh, Feb 14, 2008.

  1. Ramesh

    Ramesh Guest


    I have a requirement, wherein I have two NICs on a single host. One of
    the NIC would be in a standby state. The idea is to provide
    hotstandby, in case the first NIC fails the second NIC takes over.
    Both the NICs are configured for DHCP IP and as far as I know, the
    DHCP Server binds the IP with the MAC Address provided.

    In my case I need to get the same IP for both the NICs despite them
    having different MAC Addresses, basically because the host is the same
    and much of the host configuration is tied up with the IP. I checkced
    the DHCP server man pages, it states the IP can also be bound to a
    "Client Identifier".

    So, to make sure I get the same IP both these NICs, should I set the
    "client Id" like a host name and send the DHCP Discover message?
    Please advice if there is some kind of configuration needs to be done
    on the server side too?

    Ramesh, Feb 14, 2008
    1. Advertisements

  2. Ramesh Guest

    I did it one time in a very messy way...
    It was something like this:

    host first {
    hardware ethernet 00:00:00:00:00:01;

    host second {
    hardware ethernet 00:00:00:00:00:10;

    So, we got some cons: this configuration doesn't work with DDNS

    I think (didn't test it) that you may make a bridge between the two
    interfaces and use 2 switch ports:

    brctl addbr br0
    brctl addif br0 eth0
    brctl addif br0 eth1

    ip addr add dev eth0
    ip addr add dev eth1

    ip link set dev eth0 up
    ip link set dev eth1 up
    ip link ser dev br0 up

    ip addr add dev br0

    This also is a very very messy way, but is a way... Use you
    imagination and create a new one...
, Feb 15, 2008
    1. Advertisements

  3. Hello,

    a écrit :
    Don't forget to enable STP (spanning tree) on the bridge and the switch,
    else you create a loop. Also, a bridge changes the MAC address of some
    of its interfaces : usually the bridge takes the MAC address of the
    first interface and duplicates it on the other interfaces. So you could
    just duplicate the MAC address of one interface to the other.
    Another approach may be to use bonding with the ifenslave utility ; some
    bonding modes such as active-backup (mode 1) are fault tolerant. However
    some modes may require support by the switch.
    Pascal Hambourg, Feb 15, 2008
  4. Ramesh Guest

    I didn't say it cause STP is enabled by default. And you are right,
    the bridge MAC Address will be the one on the first interface added to
, Feb 16, 2008
  5. a écrit :
    Here STP appears to be disabled by default :

    # brctl addbr br0
    # brctl show
    bridge name bridge id STP enabled interfaces
    br0 8000.000000000000 no

    Debian 3.1 (sarge) with kernel 2.4.33 and bridge-utils 1.0.4.
    Maybe it has changed in more recent kernel and/or bridge-utils versions.
    Pascal Hambourg, Feb 16, 2008
  6. Ramesh Guest

    [email protected]:~# brctl show
    bridge name bridge id STP enabled interfaces
    br0 8000.00022ab2fc18 yes eth0

    At my set it is enabled...
    Slackware 11.0 kernel

    It's just a little issue...

    Everyone else, remember, just for precaution:

    # brctl stp br0 yes
, Feb 17, 2008
  7. Ramesh

    planetlarg Guest

    This is what I did. It works fine with two independant switches. The
    files I edited on Debian Etch to do this are:

    apt-get install ifenslave

    vi /etc/modprobe.d/arch/i386

    alias bond0 bonding
    alias bond1 bonding
    options bonding mode=1 miimon=100 downdelay=200 updelay=200

    vi /etc/network/interfaces

    # create one virtual IF from two ethernet IFs
    auto bond0
    iface bond0 inet static
    pre-up modprobe bond0
    hwaddress ether 00:11:22:33:44:55
    up ifenslave bond0 eth1 eth2
    down ifenslave -d bond0 eth1 eth2
    planetlarg, Feb 20, 2008
    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.