Utrecht Map Configuring multiple IPs
The first thing to do is create a script
VI 1.sh
Scripting language Start:
#!/bin/bash
Touch/ip.txt
echo "Put in the IP ranges:"
Cat>ip.txt
Read-p "Put in the Network name:" WW
Cc=-1
while read IPs;
Do
A1= ' echo $ips |awk-f '/' + ' {print $} '
A2= ' echo $ips |awk-f '/' + ' {print $} '
A3= ' echo $a 2 | Awk-f. ' {print $ '. $ "." "$"
A4= ' echo ${a2##*.} `
Let cc= $CC +1
Let n= $a 4+2
if [[$a 1-eq]];then
For ((m=0;m<=252;m=m+1))
Do
Let k=253* $CC + $m
Let y= $n + $m
Let f= $a 4+1
echo "Auto $WW: $k
Iface $WW: $k inet static
Address $a 3. $y
Netmask 255.255.255.0
Gateway $a 3. $f
">>/etc/network/interfaces
Done
elif [[$a 1-eq 26]]; Then
For ((m=0;m<=60;m=m+1))
Do
Let k=61* $CC + $m
Let y= $n + $m
Let f= $a 4+1
echo "Auto $WW: $k
Iface $WW: $k inet static
Address $a 3. $y
Netmask 255.255.255.192
Gateway $a 3. $f
">>/etc/network/interfaces
Done
elif [[$a 1-eq 27]]; Then
For ((m=0;m<=28;m=m+1))
Do
Let k=29* $CC + $m
Let y= $n + $m
Let f= $a 4+1
echo "Auto $WW: $k
Iface $WW: $k inet static
Address $a 3. $y
Netmask 255.255.255.224
Gateway $a 3. $f
">>/etc/network/interfaces
Done
elif [[$a 1-eq 28]]; Then
For ((m=0;m<=12;m=m+1))
Do
Let k=13* $CC + $m
Let y= $n + $m
Let f= $a 4+1
echo "Auto $WW: $k
Iface $WW: $k inet static
Address $a 3. $y
Netmask 255.255.255.240
Gateway $a 3. $f
">>/etc/network/interfaces
Done
elif [[$a 1-eq 29]]; Then
For ((m=0;m<=4;m=m+1))
Do
Let k=5* $CC + $m
Let y= $n + $m
Let f= $a 4+1
echo "Auto $WW: $k
Iface $WW: $k inet static
Address $a 3. $y
Netmask 255.255.255.248
Gateway $a 3. $f
">>/etc/network/interfaces
Done
Fi
Done < Ip.txt
RM-RF Ip.txt
echo "*********************************************
The IPs has been added successfully!
Please run "/etc/init.d/networking restart".
*********************************************"
#end
Scripting language End
To execute permissions
chmod +x 1.sh
Perform:
Bash 1.sh
The IP of the installation server is copied in.
(Copy from small to large)
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/83/93/wKiom1d2NwOgIYHYAAAGjbHd-EY671.png-wh_500x0-wm_3 -wmp_4-s_284847702.png "title=" qq picture 20160701172510.png "alt=" Wkiom1d2nwogiyhyaaagjbhd-ey671.png-wh_50 "/>
Ps:ip section will not give you detailed explanation
After carriage return, press ctrl-d to end
Then restart the network card to
For the time being, I don't know if it's suitable for Debian
This article from "Li Jingxiang" blog, declined reprint!
Utrecht Map Configuring multiple IPs