Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

Binding a single IP Address to two different MAC addresses

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2008, 06:40 PM
Default Binding a single IP Address to two different MAC addresses



Hello.

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?

Thanks
Ramesh


Ramesh
Reply With Quote
  #2  
Old 02-15-2008, 10:33 PM
pedro.forum@gmail.com
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

On Feb 14, 4:40*pm, Ramesh <rrame...@gmail.com> wrote:
> 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".


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;
fixed-addres 192.168.0.10;
}

host second {
hardware ethernet 00:00:00:00:00:10;
fixed-address 192.168.0.10;
}

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

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 0.0.0.0 dev eth0
ip addr add 0.0.0.0 dev eth1

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

ip addr add 192.168.0.10 dev br0

This also is a very very messy way, but is a way... Use you
imagination and create a new one...
Reply With Quote
  #3  
Old 02-15-2008, 10:52 PM
Pascal Hambourg
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

Hello,

(E-Mail Removed) a écrit :
>
> I think (didn't test it) that you may make a bridge between the two
> interfaces and use 2 switch ports:


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.
Reply With Quote
  #4  
Old 02-16-2008, 04:58 PM
pedro.forum@gmail.com
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

On Feb 15, 8:52*pm, Pascal Hambourg <boite-a-s...@plouf.fr.eu.org>
wrote:
> 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.


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
it.
Reply With Quote
  #5  
Old 02-16-2008, 05:40 PM
Pascal Hambourg
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

(E-Mail Removed) a écrit :
>
> I didn't say it cause STP is enabled by default.


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.
Reply With Quote
  #6  
Old 02-17-2008, 06:47 PM
pedro.forum@gmail.com
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

On Feb 16, 3:40*pm, Pascal Hambourg <boite-a-s...@plouf.fr.eu.org>
wrote:
> Here STP appears to be disabled by default :


root@alderan:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00022ab2fc18 yes eth0
ath0

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

It's just a little issue...

Everyone else, remember, just for precaution:

# brctl stp br0 yes
Reply With Quote
  #7  
Old 02-20-2008, 02:35 PM
planetlarg
Guest
 
Posts: n/a
Default Re: Binding a single IP Address to two different MAC addresses

On 15 Feb, 22:52, Pascal Hambourg <boite-a-s...@plouf.fr.eu.org>
wrote:
> 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.


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

add
....
alias bond0 bonding
alias bond1 bonding
options bonding mode=1 miimon=100 downdelay=200 updelay=200
max_bonds=3
....

vi /etc/network/interfaces

add
....
# 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
address 192.168.0.2
netmask 255.255.255.0
up ifenslave bond0 eth1 eth2
down ifenslave -d bond0 eth1 eth2
#
....
Reply With Quote
Reply

Tags
address, addresses, binding, mac, single

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 02:56 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.