0

How to create multiple addresses using netplan in Ubuntu 18.04? I want to assign 50 addresses using notation like 192.10.23.1/24-192.10.23.50/24. Is it possible?

0

It's certainly possible.

Here you can file lots of examples on how to configure netplan for various use cases. For your specific needs it should be as simple as

network:
  version: 2
  renderer: networkd
  ethernets: 
    enp3s0:                     # Use your interface name
     addresses:
       - 192.10.23.1/24
       - 192.10.23.2/24
       - ...                    # fill all 50 addresses
       - 192.10.23.50/24
     gateway4: 192.10.23.254/24 # use your gateway, or none if it's not needed

I've used this as a reference.

Don't forget to do a sudo netplan apply to commit your changes.

0

I can't see any range option in netplan configuration. What I can only suggest is to use script, for example in Bash to generate your range:

gen.sh:
#!/bin/bash

for i in {1..50}
do
echo "    - 192.10.23.$i/24" # <-- watch for spaces :)
done

Then:

$ bash gen.sh > config.yml

Add some header / footer and you're done Cheers, Paweł

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.