0

I just configured a Debian 10 virtual private server on a new hosting provider and somehow /etc/network/interfaces is missing.

Running ip a reveals a lo and eth0@if24 interface.

Trying to add an interface alias to eth0@if24.

What is going on here?

sunknudsen
  • 701
  • 3
  • 14
  • 28

3 Answers3

1

Your "virtual machine" is actually a container, not a virtual machine, and it appears your container host is configuring networking for you.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Thanks Michael. The hosting provider is using LXD vs KVM... do you know how I can add interface aliases in this context? – sunknudsen Aug 05 '20 at 17:45
  • 1
    @sunknudsen You don't add interface aliases. They have been deprecated for more than a decade. Just add the additional IP addresses to the interface. – Michael Hampton Aug 05 '20 at 18:31
  • I am actually trying to solve https://serverfault.com/questions/1029000/how-to-fix-no-address-range-available-for-dhcp-request-error hence why I am trying to create the alias. Have a moment to help? – sunknudsen Aug 05 '20 at 18:47
  • @sunknudsen Again, you don't add interface aliases. They don't even strictly exist anymore. If you think you are making one, it's ignored and the IP address is added to the specified interface, no alias, just a human readable label attached to the IP address. As for the other problem, this probably isn't the way to solve it. – Michael Hampton Aug 05 '20 at 18:53
1

Thanks to the help of Wesley, I figured it out.

That VPS was configured to use SystemdNetworkd so files in /etc/systemd/network instead of /etc/network/interfaces.

Also, thanks to Michael, I learned that interface aliases are a thing of the past.

See How to configure interface aliases using Systemd-Networkd?.

sunknudsen
  • 701
  • 3
  • 14
  • 28
0

Your host is probably using NetPlan and CloudInit. /etc/network/interfaces is old and deprecated, so... don't use it. Check for the existence of /etc/netplan/config.yaml Have a plan for netplan

Wesley
  • 32,690
  • 9
  • 82
  • 117
  • Thanks for helping out Wesley. `cat: /etc/netplan/config.yaml: No such file or directory` and `ls: cannot access '/etc/cloud': No such file or directory`. – sunknudsen Aug 05 '20 at 17:48
  • Is the yaml file missing, or the directory? There isn't a config.yaml file by default, but the netplan directory exists. Also, there should be a `netplan` command in your path, e.g. `netplan --help` – Wesley Aug 05 '20 at 17:55
  • `ls: cannot access '/etc/netplan/': No such file or directory` and `-bash: netplan: command not found` – sunknudsen Aug 05 '20 at 17:59
  • So it would seem that initial networking is set up by cloudinit, but then netplan is left as an exercise for the customer. – Wesley Aug 05 '20 at 18:06
  • Are we sure netplan is involved? There has to be a file somewhere to configure this right? – sunknudsen Aug 05 '20 at 18:07
  • Btw, do you know what is up with `@if24` in `eth0@if24`? – sunknudsen Aug 05 '20 at 18:10
  • Ah, right, I spaced it. This is systemd-networkd in the mix, so yes, netplan is out. systemd is in. You'll probably see some stuff with `systemctl list-units -t network`. Or not - depending. :D – Wesley Aug 05 '20 at 18:17
  • Running `systemctl list-units -t network` returns `Unknown unit type or load state 'network'.`. This is quite a puzzle! – sunknudsen Aug 05 '20 at 18:19
  • Another way around my issue would be solving https://serverfault.com/questions/1029000/how-to-fix-no-address-range-available-for-dhcp-request-error. Do you have a moment to have a look? – sunknudsen Aug 05 '20 at 18:25
  • I just hacked out the `-t network` as a semi-educated guess. TL;DR systemd-networkd is likely your next avenue. – Wesley Aug 05 '20 at 18:29
  • Thanks Wesley! We’re onto something. `/etc/systemd/network/eth0.network` exists. Now I have to figure out how to add aliases in the context of systemd. – sunknudsen Aug 05 '20 at 18:35
  • See https://serverfault.com/questions/1029004/how-to-configure-interface-aliases-using-systemd-networkd – sunknudsen Aug 05 '20 at 18:45
  • Hey Wesley, thanks to your help I got things sorted. Thanks! It was systemd-networkd. Do you want to update your answer or should I submit one? See https://serverfault.com/questions/1029004/how-to-configure-interface-aliases-using-systemd-networkd. – sunknudsen Aug 07 '20 at 20:54
  • @sunknudsen You should probably write your own - you did all the heavy lifting. Reap the benefits! :D – Wesley Aug 07 '20 at 21:15
  • Couldn’t have done it without you but okidoki. – sunknudsen Aug 07 '20 at 21:21