0

So I have a dedicated server for which I need a second IP adress. After ordering the adress the hoster just told me that i can now use the ip (giving me the IP, gateway and netmask). OS: Ubuntu 20.04.5 LTS x86_64

My issue is that I don't understand how to use netplan and the hoster is not helping a lot. Just saying that the interface should be :0 so as the primary is eno2 it should be eno2:0 and he said that they both need to be static (before the first interface was with dhcp activated)

My current netplan cfg is this but with it i still don't see the second IP/interface when doing e.g. ifconfig:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno2:
      addresses: [IP_ONE/24]
      dhcp4: no
      gateway4: GATEWAY_IP
    eno2:0:
      addresses: [IP_TWO/24]
      dhcp4: no

Thanks in advance.

flololan
  • 101

1 Answers1

0

You don't need to add extra network interfaces, you can have as many IP addresses on the same interface. Please see the example bellow.

network:
  version: 2
  renderer: networkd
  ethernets:
    eno2:
      addresses: 
        - [IP_ONE/24]
        - [IP_TWO/24]
      dhcp4: no
      gateway4: GATEWAY_IP
  • Thank you: I had syntax errors so I slightly adapted: ``` network: version: 2 renderer: networkd ethernets: eno2: addresses: - IP_ONE/24 - IP_TWO/24 dhcp4: no gateway4: GATEWAY_IP ``` Sadly, after applying, I still see only the first IP in ifconfig, even after reboot. – flololan Jan 03 '23 at 16:25
  • Weird, [here](https://netplan.io/examples) are some examples for configuring netplan, is eno2 the name of your network interface? When you try `sudo netplan try` does it return an error? – Michael Angel P. Jan 03 '23 at 16:45
  • Eno2 is the name of the first interface, yes. According to the hosting provider the second one should be eno2:0. netplan try does not give any errors with your example. – flololan Jan 04 '23 at 10:21
  • Check this post [here](https://askubuntu.com/questions/1033592/detecting-whether-netplan-is-managing-network-config-shell) in order to make sure that your system indeed uses netplan and not another configuration utility, it has happened in the past on a system I had to configure netplan but use another configuration file elsewhere. Also is this the only netplan file? If there are multiple files they could create a collision but then netplan should notify you. – Michael Angel P. Jan 04 '23 at 11:16