Score:0

Set up multiple static IPs on virtual ethernet interface on Ubuntu 18.04

hn flag

I'm trying to set up 5 static ipv4, 5 static ipv6s and a dhcp ipv4/6 on a single ethernet card (for unimportant reasons). I don't know if I actually need the ip addresses to have separate virtual ethernet interfaces - the purpose of this is to have multiple instances of the same port available for a piece of software I need to run multiple instances of.

I've tried using a netplan config that looks like this

network:
  version: 2
  renderer: NetworkManager

  ethernets:
    enp3s0:
      dhcp4: true
      dhcp6: true
      addresses:
        - x.y.z.231/24:
            label: "enp3s0:1"
        - fd00:1::231/64:
            label: "enp3s0:1"

        - x.y.z.232/24:
            label: "enp3s0:2"
        - fd00:1::232/64:
            label: "enp3s0:2"

        - x.y.z.233/24:
            label: "enp3s0:3"
        - fd00:1::233/64:
            label: "enp3s0:3"

        - x.y.z.234/24:
            label: "enp3s0:4"
        - fd00:1::234/64:
            label: "enp3s0:4"

        - x.y.z.235/24:
            label: "enp3s0:5"
        - fd00:1::234/64:
            label: "enp3s0:5"
      gateway4: "x.y.z.1"
      gateway6: "::"

But its not getting me anywhere - its valid yaml but netplan is throwing an error:

Error in network definition: expected scalar
    - "x.y.z.231/24":

Help appreciated!

Bodo avatar
pt flag
Please [edit] your question and show a valid file that actually reproduces the problem, not something *like* your real file. The IPv6 addresses starting with `fd00` are Unique Local Addresses which cannot be routed via the internet. Are your IPv4 addresses `x.y.z.*` public IP addresses that anyone could try to reach or local addresses that are valid in your local network only, like `102.168.*.*` or `10.*.*.*`? In the latter case it should be no problem to show the real addresses. Otherwise use correct addresses from one of the local address ranges.
Mauvai avatar
hn flag
@Bodo You too me a little too literally there, barring a substitution for the x.y.z this is the file I used, and that was the result I got. the ipv6 addresses are supposed to be ULAs, the ipv4s are also non routing private addresses, but they do route within the internal company network, so I didn't particularly want to share them (the ipv6s do not so I was less concerned). Probably unnecessary but wanted to be cautious
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.