Dnsmasq: mapping 2 MAC addresses to the same IP address

dhcpopenwrt

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.

Best Answer

(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:

May 23 17:45:16 gateway dnsmasq[1925]: started, version 2.55 cachesize 150

My configuration:

$ cat /etc/config/dhcp

config 'dnsmasq'
    option 'domainneeded' '1'
    option 'boguspriv' '1'
    option 'localise_queries' '1'
    option 'rebind_protection' '1'
    option 'rebind_localhost' '1'
    option 'expandhosts' '1'
    option 'authoritative' '1'
    option 'readethers' '1'
    option 'leasefile' '/tmp/dhcp.leases'
    option 'resolvfile' '/tmp/resolv.conf.auto'
    option 'enable_tftp' '1'
    option 'domain' 'domain.net'
    option 'local' '/domain.net/'

config 'dhcp' 'lan'
    option 'interface' 'lan'
    option 'start' '100'
    option 'limit' '150'
    option 'leasetime' 'infinite'

config 'dhcp' 'wan'
    option 'interface' 'wan'
    option 'ignore' '1'
    option 'dynamicdhcp' '0'

config 'dhcp'
    option 'interface' 'dmz'
    option 'start' '100'
    option 'limit' '150'
    option 'leasetime' '12h'

config 'host'
    option 'name' 'travelmate'
    option 'mac' '00:11:22:33:44:55 aa:bb:cc:dd:ee:ff'
    option 'ip' '192.168.1.111'

config 'host'
    option 'name' 'mobilitymac'
    option 'mac' '99:88:77:66:55:44 ff:ee:dd:cc:bb:aa'
    option 'ip' '192.168.1.104'

Enjoy the seamless transition this setup provides, all existing session stay alive if you don't take too long with the switch.