Home / Community / Blog

In some cases you would like to have one IP for computer no matter how it's connected - using Ethernet or WiFi.

My reason was BackupPC - it uses names to distinguish hosts. Unfortunately Web interface in my router only allows 1-to-1 association between MAC, IP and host name (using /etc/ethers and /etc/hosts files), so I have two positions:

Hostname MAC IP
mylaptop 00:00:00:23:B2:25 192.168.1.10
mylaptop-lan 00:00:00:80:B2:0A 192.168.1.11

To bypass this restriction I have to do it manually.

First of all I had to remove both MAC form web interface so they don't disturb my own configuration (You can check if the IP is gone in /etc/ethers or /etc/hosts file).

I've decided to create separate file for my changes so I've created empty /etc/dnsmasq-jaqb.conf and added at the end of /etc/dnsmasq.conf:

conf-file=/etc/dnsmasq-jaqb.conf

(to be honest I've this file for my previous changes ;-)

Then I've added name-to-ip association to /etc/dnsmasq-jaqb.conf

dhcp-host=mylaptop,192.168.1.10,24h
cname=mylaptop-lan,mylaptop

Now, after restart dnsmasq of course, my computer always get the same IP.

The last line is not necessary - it is to help some of my scripts to work because they assume there is host named mylaptop-lan.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31