<div dir="ltr"><div dir="ltr">On Tue, Jun 16, 2020 at 4:13 AM Roman Odaisky <<a href="mailto:roma@qwertty.com">roma@qwertty.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I would like to assign a static IP address to a server in a way that survives <br>
hardware replacement. Basically I want the configuration to say: “Find the only <br>
physical interface present and assign this static IP address to it. In the <br>
unexpected case of finding multiple interfaces, assign the address to some <br>
interface”.<br>
<br>
The problem I’m trying to avoid is that if the hardware of a headless server <br>
fails, then moving its drive(s) to another server may cause it to become <br>
inaccessible if the name of the link becomes different.<br>
<br>
Similarly, if I prepare a USB drive to troubleshoot headless server issues, I <br>
need to have it assign an address to at least one interface without knowing in <br>
advance what its name is.<br>
<br>
What would be appropriate .link/.network entries that achieve this and avoid <br>
assigning the same address to more than one interface or interfering with <br>
virtual interfaces?<br></blockquote><div><br></div><div>In this case I would just *disable* the persistent naming feature, so that you would always keep the kernel-assigned "eth0" name.</div><div><br></div><div><div>(This would be either setting <font face="monospace">NamePolicy=</font> to an empty value in a .link file so that no naming policies are applied, or outright booting with the "<font face="monospace">net.ifnames=0</font>" kernel parameter.)</div></div><div><br></div><div>This works perfectly fine as long as you have exactly one physical Ethernet interface, as you claimed. If you have multiple, one of them will still be "eth0" and will still get the IP address... you just can't be sure <i>which </i>one. (They might even swap after a reboot.)</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>