Score:0

Can't add second IP adress via Netplan on Ubuntu

id flag

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.

Score:0
ru flag

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
flololan avatar
id flag
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.
Michael Angel P. avatar
ru flag
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?
flololan avatar
id flag
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.
Michael Angel P. avatar
ru flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.