debain gen sub-interface

 

Script

#!/bin/bash
# debain gen sub-interface

_ipstart="n"
_ipend="m"
_myip="o"

for (( _c=$_ipstart; _c<=$_ipend; _c++ ))
do
        echo "auto eth0:$_c"
        echo "iface eth0:$_c inet static"
        echo "        address $_myip.$_c"
        echo "        netmask 255.255.255.0"
        echo ""
done

P.S.

sub-interface 不能用 "." 的, 因為 "." 有特別意思

Creative Commons license icon Creative Commons license icon