Is it possible to map 2 different MAC addresses to the same IP address?
For my backup, I need to connect back from the server to the portable, and I would like to have the same IP both for the wireless and the wired interface.
The openwrt web interface doesn't accept multiple dhcp entries with the same IP address, but perhaps there is a workaround?
Clarification added on 23 may:
I should have made it clear that only one of the network interfaces of the portable is connected to the network at any given time (hence switches shouldn't get confused). Initially I had 2 distinct IP addresses assigned to the interfaces, with the same DNS name, but this didn't work very well (timeouts when I got the wrong IP). Yet I want to use the same name for both, as it is hard-coded in my backup script.
Sorry for the confusion.
(random semi-opinionated comment: it's rare to see this highish count of unconstructive and plain inaccurate answers and comments to a question)
In contrast to others here, I claim that your request is actually quite elementary and has been supported in dnsmasq since version 2.46, IIRC. This was the sole reason I switched from dd-wrt. After about a year of running OpenWRT, I now know there are actually plenty more reasons to switch, but that's beside the point.
I'm running Backfire 10.04-rc4:
My configuration:
Enjoy the seamless transition this setup provides, all existing session stay alive if you don't take too long with the switch.
I did a bit of research.
First thing I learned is that it is possible to assign DHCP leases based on criteria other than a MAC address.
From the dhcp FAQ:
Then, although it is apparently not supported by the luci web interface on openWRT, dnsmasq itself supports client_id, and multiple MAC addresses (with the some cautioning).
From the dnsmasq man page:
I opted for the multi-mac solution (because I didn't try to find out how I could specify the client id on the client side, which is something that has to be done for each separate client, and the multi-mac alternative is one solution for all the portables in the house.)
I circumvented the luci interface, and added directly to /etc/dnsmasq.conf the following line:
and /etc/dnsmasq-dhcphosts.conf contains lines of the following format:
(I keep this config in a seperate file to prevent to have it overwritten by the next update.)
Works fine.
Your aim: to have constant-hostname-of-laptop always point to the (active IP address/interface of the) laptop? I would have thought that the combined DNS-and-DHCP service of dnsmasq would do that, i.e. when a client does a DHCPDISCOVER/DHCPREQUEST it reports its hostname, and dnsmasq associates the hostname with whichever IP address is assigned. That has been my experience, however I must admit I've not tried connecting with one network i/f, then disconnecting (without doing an explicit release) and connecting again with another.
Assuming a hostname of "laptop", what happens when you query the OpenWRT device for "laptop", after having switched from one interface to another?
Why use DHCP?
You can manually configure a static IP address on both interfaces, and then use the one you prefer (while leaving the other one disconnected, of course).
I would be very surprised if your switch can support this. You might have more luck giving both network interfaces the same MAC address.
Saying that, I definitely agree with Holocryptic, here be dragons.
No, it's not possible. But most NICs allow you to administartively set the MAC, and you could set both NICs to the same MAC.
On most *nix boxen you can usually do this, then setup a failover LAGG interface to both (with preference for the wired) to allow your to hotplug the wired connection without disconnecting TCP sessions.