This shows you the differences between two versions of the page.
— |
ip_alias_script_for_debian [2010/09/28 17:56] (current) k2patel created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Script to Add multiple IP to Debian ====== | ||
+ | |||
+ | This script add all IP in single file as an alias | ||
+ | |||
+ | <code text | /etc/network/ip_range> | ||
+ | 192.168.1.4 | ||
+ | 192.168.1.5 | ||
+ | 192.168.1.7 | ||
+ | 192.168.1.8 | ||
+ | 192.168.1.11 | ||
+ | 10.10.1.34 | ||
+ | 10.10.1.23 | ||
+ | </code> | ||
+ | |||
+ | <code bash | /etc/network/ipalias.sh > | ||
+ | #!/bin/bash | ||
+ | i=0; | ||
+ | while read ip | ||
+ | do | ||
+ | /sbin/ifconfig eth0:${i} $ip netmask 255.255.255.240 up | ||
+ | let i=$i+1 | ||
+ | done < /etc/network/ip_range | ||
+ | </code> | ||
+ | |||
+ | <code bash> | ||
+ | chmod 755 /etc/network/ipalias.sh | ||
+ | </code> | ||
+ | |||
+ | execute script in cron @reboot or /etc/rc.local | ||