Adding A Range of IP Addresses in Debian

Comments None

Following up our previous articles about how to Add an Additional IP Address and Adding A Range of IP Addresses in CentOS we’ll now see how to add a range of IP addresses under Debian. As previously mentioned there is no easy, standard way to do so, that’s why we’re going create a small script that will automate the job for you.

#!/bin/bash for ip in {1..254}; do echo up ip addr add 192.168.1.$ip/24 dev eth0>>/etc/network/interfaces done

Once you create the file, don’t forget to set execute permissions for the file.

chmod 755

Keep an eye on the netmask /24 which may be different in your case. The script will append data in your /etc/network/interfaces file so running it twice may not be a desired behavior.

Within the next article we’ll present a similar script that will allow you to add IP addresses from a specific list, not necessary sequential.

There are currently no comments on this article.


Enter your comment below. Fields marked * are required. You must preview your comment first before finally posting.

← Older Newer →