BIND Script

Bashed

New Member
Joined
Nov 2, 2020
Messages
21
Reaction score
0
Credits
225
For Linux o/s where I assign a large quantity of IPv4 addresses, I use a simple bind script to quickly bind all IPs.

Example:

Code:
for i in $(seq 2 254);
    do
        ip addr add xxx.142.100.$i/24 dev eth0
        ip addr add xxx.142.101.$i/24 dev eth0
        ip addr add xxx.142.102.$i/24 dev eth0
        ip addr add xxx.142.103.$i/24 dev eth0        
    done

ip addr show

Is there an easier way to do a single line for whatever size subnet?

Say for example I want to bind a full straight /19 to the server. I cannot do for example...

ip addr add xxx.142.101.$i/19 dev eth0

...because of the sequence line.

Is there an alternative to this?
 


This stuff is above my head tbh. Can you provide a working alternative script example? I do not understand the info in that link sorry.
 

Members online


Top