Last active
August 29, 2015 14:07
-
-
Save pricejn2/310370f6f3210e6eb948 to your computer and use it in GitHub Desktop.
Generate ifconfig entries. Useful for large IP blocks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$vt = 21; // vt start | |
$ip = 48; // ip start | |
$vt_static = "eth2:"; | |
$ip_static = "192.99.243."; | |
$ip_max = "55"; | |
while ($ip <= $ip_max) { | |
$vt_full = ''; | |
$vt_full .= $vt_static; | |
$vt_full .= $vt; | |
$ip_full = ''; | |
$ip_full .= $ip_static; | |
$ip_full .= $ip; | |
echo "post-up /sbin/ifconfig ".$vt_full." ".$ip_full." netmask 255.255.255.255 broadcast ".$ip_full.PHP_EOL; | |
echo "post-down /sbin/ifconfig ".$vt_full." down".PHP_EOL; | |
$vt++; | |
$ip++; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment