Index: drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh
===================================================================
--- drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh	(revision 180)
+++ drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh	(revision 181)
@@ -31,15 +31,18 @@
     Host_first_IP=""
     Host_last_IP=""
-    get_Host_IP_range $eth
+    get_Host_IP_range
     # == Get VM number & IP range  ==
-    VM_IP_range=""
+    declare -i VM_IP_range=""
+    declare -i Host_last_IP_4=""
     VM_first_IP=""
     VM_last_IP=""
-    get_VM_IP_range $eth
+    get_VM_IP_range
     # == Get VM IP prefix hostname  ==
     VM_prefix_name=""
-    get_VM_prefix_name $eth
+    get_VM_prefix_name
     
+
 done
+
 
 
Index: drbl-virt/sbin/functions_drbl_virt
===================================================================
--- drbl-virt/sbin/functions_drbl_virt	(revision 180)
+++ drbl-virt/sbin/functions_drbl_virt	(revision 181)
@@ -157,5 +157,5 @@
 
 function get_DRBL_eth(){
-eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt | cut -d "-" -f2 | cut -d "." -f1)
+eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt$ | cut -d "-" -f2 | cut -d "." -f1)
 eths_nu=$(echo $eths | wc -l)
 
@@ -170,11 +170,11 @@
 
 # get eth network
-eth_address=$(/opt/drbl/bin/drbl-get-ipadd $1)
-eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $1)
+eth_address=$(/opt/drbl/bin/drbl-get-ipadd $eth)
+eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $eth)
 eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
 eth_network_f3=$(echo $eth_network | cut -d "." -f 1-3)
 
 IP_nu=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | wc -l)
-Host_first_IP=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | awk "NR==1 {print $1}" | awk '{print 1}')
+Host_first_IP=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | awk "NR==1 {print $1}" | awk '{print $1}')
 Host_last_IP=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | awk "NR==$IP_nu {print $1}"| awk '{print $1}')
 
@@ -183,5 +183,5 @@
 function get_VM_IP_range(){
 echo ""
-echo "DRBL client IP range -> $1 [$Host_first_IP ~ $Host_last_IP]"
+echo "DRBL client IP range -> $eth [$Host_first_IP ~ $Host_last_IP]"
 
 declare -i Host_last_IP_4=$(echo $Host_last_IP | cut -d "." -f4)
@@ -195,5 +195,5 @@
 do
     echo ""
-    echo "Input VM number/IP range in $1 (ex. 40)."
+    echo "Input VM number/IP range in $eth (ex. 40)."
     read -p "(If you have 10 PCs(4-core), suggestion is 30): " VM_IP_range
     read -p "Is it correct? (yes/no): " jude
@@ -209,5 +209,5 @@
 do
     echo ""
-    read -p "Input Prefix name for VM in $1 (ex. drblvm): " VM_prefix_name
+    read -p "Input Prefix name for VM in $eth (ex. drblvm): " VM_prefix_name
     read -p "Is it correct? (yes/no): " jude
 done
@@ -217,8 +217,52 @@
 function create_VM_IP_table(){
 #/etc/drbl-virt/etc/IP_VM_eth
-
-}
-
-
-
-
+VM_prefix_eth=$(echo $eth |  sed 's/eth//g')
+declare -i VM_Host_totoal_nu=$((${Host_last_IP_4}-1+${VM_IP_range}))
+if [ -e /opt/drbl-virt/etc/IP_VM_$eth ]; then
+    mv /opt/drbl-virt/etc/IP_VM_$eth /opt/drbl-virt/etc/IP_VM_${eth}.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
+fi
+declare -i VM_IP_0=$VM_prefix_eth
+declare -i VM_IP_1=""
+declare -i VM_IP_2=""
+declare -i VM_IP_3=""
+
+
+# 2 bit
+if [ $VM_Host_totoal_nu -lt 100 ]; then
+    for (( i=$Host_last_IP_4 ; i<="$VM_IP_range" ; i++ ))
+    do
+        if [ $i -lt 10 ]; then
+            VM_IP_1=0
+            VM_IP_2=$i
+            echo "${eth_network_f3}.$VM_IP_2 ${VM_prefix_name}${VM_IP_0}${VM_IP_1}${VM_IP_2}" >> /opt/drbl-virt/etc/IP_VM_$eth
+        else
+            VM_IP_1=$i
+            echo "${eth_network_f3}.$VM_IP_1 ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$et
+        fi
+    done
+# 3 bit
+elif [ $VM_Host_totoal_nu -ge 100 ] && [ $VM_Host_totoal_nu -lt 254 ]; then
+    for (( i=$Host_last_IP_4 ; i<=$VM_IP_range ; i++ ))
+    do
+        if [ $i -lt 10 ]; then
+            VM_IP_1=0
+            VM_IP_2=0
+            VM_IP_3=$i
+            echo "${eth_network_f3}.${VM_IP_3} ${VM_prefix_name}${VM_IP_0}${VM_IP_1}${VM_IP_2}${VM_IP_3}" >> /opt/drbl-virt/etc/IP_VM_$eth
+        elif [ $i -lt 100 ]; then
+            VM_IP_1=0
+            VM_IP_2=$i
+            echo "${eth_network_f3}.${VM_IP_2} ${VM_prefix_name}${VM_IP_0}${VM_IP_1}${VM_IP_2}" >> /opt/drbl-virt/etc/IP_VM_$eth
+        else
+            VM_IP_1=$i
+            echo "${eth_network_f3}.${VM_IP_1} ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$eth
+        fi
+
+    done
+
+fi
+}
+
+
+
+
