NicoCaldo
NicoCaldo

Reputation: 1577

Delete an IP address to the loopback interface on netplan

I needed to add a new IP to the loopback interface (besides the usual localhost 127.0.0.1)

On my Ubuntu server running Netplan I've added on the .yaml file the code

lo:
    addresses: [50.1.0.1/16]

I applied and everything was cool. The issue came after I wanted to change the IP address; so I edited the file with the new IP for the loopback interface:

lo:
    addresses: [10.1.0.1/16]

and now, after having applied, I have both IPs.

How can I delete the previews IP and how can I rewrite the configuration instead of adding IPs every time I want to change it?

Upvotes: -1

Views: 1312

Answers (1)

NicoCaldo
NicoCaldo

Reputation: 1577

Try to use:

ethernets:
        lo:
            match:
                name: lo
            addresses: [ 10.1.0.1/16 ]

instead.

It should keep just the IP you want

Upvotes: 0

Related Questions