Binding a single IP Address to two different MAC addresses

Binding a single IP Address to two different MAC addresses

Post by Rames » Sat, 16 Feb 2008 03:40:25



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

 
 
 

Binding a single IP Address to two different MAC addresses

Post by pedro.fo.. » Sun, 17 Feb 2008 07:33:08



Quote:> 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;

Quote:}

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

Quote:}

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...

 
 
 

Binding a single IP Address to two different MAC addresses

Post by Pascal Hambour » Sun, 17 Feb 2008 07:52:33


Hello,


Quote:

> 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.
 
 
 

Binding a single IP Address to two different MAC addresses

Post by pedro.fo.. » Mon, 18 Feb 2008 01:58:00




Quote:> 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.
 
 
 

Binding a single IP Address to two different MAC addresses

Post by Pascal Hambour » Mon, 18 Feb 2008 02:40:55



Quote:

> 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.

 
 
 

Binding a single IP Address to two different MAC addresses

Post by pedro.fo.. » Tue, 19 Feb 2008 03:47:01




Quote:> Here STP appears to be disabled by default :


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

 
 
 

Binding a single IP Address to two different MAC addresses

Post by planetlar » Thu, 21 Feb 2008 23:35:38




Quote:> 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
#
...

 
 
 

1. binding IP Address to MAC Address (newbie)

-running RH 5.2 with ip masquerading (ipfwadm)

-using 32 bit addressing to masquerade the machines one by one, e.g., for
192.168.1.3 machine:

ipfwadm -F -a m -S 192.168.1.3/32 -D 0.0.0.0/0

The problem is I have several IP numbers I have to masquerade for drop
connections. I have other machines on the network for which I can't allow
internet access. I would like to prevent these machines from stealing one of
the "free" masqueraded IP numbers by changing the IP address on their
machine and thus using the masqueraded connection.

==> I think I would like to bind the MAC address to the IP address and
disallow any illegal IP/MAC combination.

How do I do it? I was told this is where arp comes in.

--
Father Parthenios

2. Need help with 'find' command

3. why ifconfig shows two identical MAC address for two different NIC

4. IP alias with wrong subnet mask in rh5.1

5. WANTED: pingmac <IP ADDR> which returns <MAC ADDRESS of IP ADDRESS>

6. communicator 4.04 hangs?

7. IP Masquerading with IP Address and Mac Address Restrictions

8. Xservers?

9. Is different 'Ethenet address' from 'Mac Address' ?

10. Single NIC card bound with 2 IP Addresses?

11. binding a single IP address to multiple NICs

12. Binding multiple IP addresses to a single NIC

13. Multiple IP addresses in different networks on a single machine