1

I've setup the Debian package dropbear-initramfs to unlock my homeservers disk over SSH. Unfortunately, the router assigns a different IP to the server on every boot and its DNS does not know the server by its hostname at initramfs stage.

Once I unlocked the disk and the server completed boot, I can resolve its hostname.

1 Answer 1

1

You need to configure your router to assign a fixed IP address to your server based on its MAC address.

The details on how to do this depend on your router. Search its configuration options for DHCP server or DHCP daemon or similar.

You'll need to identify the server's MAC address first, though - run ifconfig or ip addr on the server. e.g. if you know that the network interface is called "eth0":

# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 00:23:cd:b0:23:b9 brd ff:ff:ff:ff:ff:ff

The MAC address in this case is 00:23:cd:b0:23:b9. You can extract that by itself with awk:

# ip addr show dev eth0 | awk '/link/ {print $2}'
00:23:cd:b0:23:b9

Once you have the MAC address, you should be able to configure your router's DHCP daemon to assign a fixed IP address whenever it sees a DHCP request from that MAC. You may also need to configure the router so that the fixed address is not in the dynamically assigned range (e.g. if your DHCP daemon assigns addresses from 192.168.0.0/24 then you should reserve, say, 192.168.0.1 - 192.168.0.99 for fixed address allocations, and 192.168.0.100 to 192.168.0.254 for dynamic allocations. 100 fixed addresses and 154 dynamic should be plenty for a small LAN)

If your router/DHCP server can't do that, then replace it with one that isn't worthless garbage.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.