#parameter:
#~ create => untuk buat switch, gateway, router dan workstation
#~ config {gateway | bridge | nama_router | nama_komputer} => konfigurasi
#~ routing {gateway | nama_computer | nama_router} => routing
case "$1" in
create) uml_switch -unix 3901 > /dev/null < /dev/null &
uml_switch -unix 3902 > /dev/null < /dev/null &
uml_switch -unix 3903 > /dev/null < /dev/null &
uml_switch -unix 3904 > /dev/null < /dev/null &
uml_switch -unix 3905 > /dev/null < /dev/null &
uml_switch -unix 3906 > /dev/null < /dev/null &
echo "|====== |"
echo " 30%"
echo
sleep 2
linux ubd0=cow_matahari,root_fs umid=matahari con=pts con0=xterm eth0=tuntap,,,10.126.13.176 eth1=daemon,,unix,3901 &
sleep 10
linux ubd0=cow_bridge,root_fs umid=bridge con=pts con0=xterm eth0=daemon,,unix,3901 eth1=daemon,,unix,3906 &
sleep 10
linux ubd0=cow_mars,root_fs umid=mars con=pts con0=xterm eth0=daemon,,unix,3906 eth1=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_titan,root_fs umid=titan con=pts con0=xterm eth0=daemon,,unix,3906 eth1=daemon,,unix,3902 &
sleep 10
linux ubd0=cow_uranus,root_fs umid=uranus con=pts con0=xterm eth0=daemon,,unix,3902 eth1=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_pluto,root_fs umid=pluto con=pts con0=xterm eth0=daemon,,unix,3904 eth1=daemon,,unix,3903 &
echo "|============ |"
echo " 60%"
echo
sleep 10
linux ubd0=cow_host0_1,root_fs umid=host0_1 con=pts con0=xterm eth0=daemon,,unix,3906 &
sleep 10
linux ubd0=cow_saturnus,root_fs umid=saturnus con=pts con0=xterm eth0=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_host128_1,root_fs umid=host128_1 con=pts con0=xterm eth0=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_host64_1,root_fs umid=host64_1 con=pts con0=xterm eth0=daemon,,unix,3902 &
sleep 10
linux ubd0=cow_host96_1,root_fs umid=host96_1 con=pts con0=xterm eth0=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_metis,root_fs umid=metis con=pts con0=xterm eth0=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_host32_1,root_fs umid=host32_1 con=pts con0=xterm eth0=daemon,,unix,3903 &
sleep 10
linux ubd0=cow_jupiter,root_fs umid=jupiter con=pts con0=xterm eth0=daemon,,unix,3903 &
echo "|====================|"
echo " 100% done"
echo
;;
config) case "$2" in
gateway) ifconfig lo 127.0.0.1 up
ifconfig eth0 10.126.13.177 netmask 255.255.255.0 broadcast 10.126.13.255
ifconfig eth1 192.168.39.1 netmask 255.255.255.224 broadcast 192.168.39.31
;;
bridge) brctl addbr br0
ifconfig eth0 promisc up
ifconfig eth1 promisc up
brctl addif br0 eth0
brctl addif br0 eth1
brctl stp br0 on
ifconfig br0 192.168.39.2 netmask 255.255.255.0 broadcast 192.168.39.31
;;
mars) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.3 netmask 255.255.255.224 broadcast 192.168.39.31
ifconfig eth1 192.168.39.129 netmask 255.255.255.224 broadcast 192.168.39.159
;;
titan) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.4 netmask 255.255.255.224 broadcast 192.168.39.31
ifconfig eth1 192.168.39.65 netmask 255.255.255.224 broadcast 192.168.39.95
;;
uranus) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.66 netmask 255.255.255.224 broadcast 192.168.39.95
ifconfig eth1 192.168.39.97 netmask 255.255.255.224 broadcast 192.168.39.127
;;
pluto) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.99 netmask 255.255.255.224 broadcast 192.168.39.127
ifconfig eth1 192.168.39.33 netmask 255.255.255.224 broadcast 192.168.39.63
;;
host0_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.5 netmask 255.255.255.224 broadcast 192.168.39.31
;;
saturnus) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.130 netmask 255.255.255.224 broadcast 192.168.39.159
;;
host128_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.131 netmask 255.255.255.224 broadcast 192.168.39.159
;;
host64_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.67 netmask 255.255.255.224 broadcast 192.168.39.95
;;
host96_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.100 netmask 255.255.255.224 broadcast 192.168.39.127
;;
metis) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.98 netmask 255.255.255.224 broadcast 192.168.39.127
;;
host32_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.35 netmask 255.255.255.224 broadcast 192.168.39.63
;;
jupiter) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.34 netmask 255.255.255.224 broadcast 192.168.39.63
;;
*) echo "Parameter 2 salah Jeeh!"
echo "1. gateway"
echo "2. bridge"
echo "3. mars"
echo "4. titan"
echo "5. uranus"
echo "6. pluto"
echo "7. host0_1"
echo "8. saturnus"
echo "9. host128_1"
echo "10. host64_1"
echo "11. host96_1"
echo "12. metis"
echo "13. host32_1"
echo "14. jupiter"
;;
esac
;;
routing) case "$2" in
gateway) route add default gw 10.126.13.1
route add -net 192.168.39.128/27 gw 192.168.39.3
route add -net 192.168.39.64/27 gw 192.168.39.4
route add -net 192.168.39.96/27 gw 192.168.39.4
route add -net 192.168.39.32/27 gw 192.168.39.4
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
bridge) route add default gw 192.168.39.1
route add -net 192.168.39.128/27 gw 192.168.39.3
route add -net 192.168.39.64/27 gw 192.168.39.4
route add -net 192.168.39.96/27 gw 192.168.39.4
route add -net 192.168.39.32/27 gw 192.168.39.4
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
mars) route add default gw 192.168.39.1
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
titan) route add default gw 192.168.39.1
route add -net 192.168.39.96/27 gw 192.168.39.66
route add -net 192.168.39.32/27 gw 192.168.39.66
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
uranus) route add default gw 192.168.39.65
route add -net 192.168.39.32/27 gw 192.168.39.99
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
pluto) route add default gw 192.168.39.97
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
host0_1) route add default gw 192.168.39.1
;;
saturnus) route add default gw 192.168.39.129
;;
host128_1) route add default gw 192.168.39.129
;;
host64_1) route add default gw 192.168.39.65
;;
host96_1) route add default gw 192.168.39.97
;;
metis) route add default gw 192.168.39.97
;;
host32_1) route add default gw 192.168.39.33
;;
jupiter) route add default gw 192.168.39.33
;;
*) echo "Parameter 2 salah Jeeh!"
echo "1. gateway"
echo "2. bridge"
echo "3. mars"
echo "4. titan"
echo "5. uranus"
echo "6. pluto"
echo "7. host0_1"
echo "8. saturnus"
echo "9. host128_1"
echo "10. host64_1"
echo "11. host96_1"
echo "12. metis"
echo "13. host32_1"
echo "14. jupiter"
;;
esac
;;
*) echo "Parameter 1 salah jeeeh!"
echo "1. create => buat virtual machine"
echo "2. config => config virtual machine"
echo "3. routing => routing virtual machine"
;;
esac
#~ create => untuk buat switch, gateway, router dan workstation
#~ config {gateway | bridge | nama_router | nama_komputer} => konfigurasi
#~ routing {gateway | nama_computer | nama_router} => routing
case "$1" in
create) uml_switch -unix 3901 > /dev/null < /dev/null &
uml_switch -unix 3902 > /dev/null < /dev/null &
uml_switch -unix 3903 > /dev/null < /dev/null &
uml_switch -unix 3904 > /dev/null < /dev/null &
uml_switch -unix 3905 > /dev/null < /dev/null &
uml_switch -unix 3906 > /dev/null < /dev/null &
echo "|====== |"
echo " 30%"
echo
sleep 2
linux ubd0=cow_matahari,root_fs umid=matahari con=pts con0=xterm eth0=tuntap,,,10.126.13.176 eth1=daemon,,unix,3901 &
sleep 10
linux ubd0=cow_bridge,root_fs umid=bridge con=pts con0=xterm eth0=daemon,,unix,3901 eth1=daemon,,unix,3906 &
sleep 10
linux ubd0=cow_mars,root_fs umid=mars con=pts con0=xterm eth0=daemon,,unix,3906 eth1=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_titan,root_fs umid=titan con=pts con0=xterm eth0=daemon,,unix,3906 eth1=daemon,,unix,3902 &
sleep 10
linux ubd0=cow_uranus,root_fs umid=uranus con=pts con0=xterm eth0=daemon,,unix,3902 eth1=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_pluto,root_fs umid=pluto con=pts con0=xterm eth0=daemon,,unix,3904 eth1=daemon,,unix,3903 &
echo "|============ |"
echo " 60%"
echo
sleep 10
linux ubd0=cow_host0_1,root_fs umid=host0_1 con=pts con0=xterm eth0=daemon,,unix,3906 &
sleep 10
linux ubd0=cow_saturnus,root_fs umid=saturnus con=pts con0=xterm eth0=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_host128_1,root_fs umid=host128_1 con=pts con0=xterm eth0=daemon,,unix,3905 &
sleep 10
linux ubd0=cow_host64_1,root_fs umid=host64_1 con=pts con0=xterm eth0=daemon,,unix,3902 &
sleep 10
linux ubd0=cow_host96_1,root_fs umid=host96_1 con=pts con0=xterm eth0=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_metis,root_fs umid=metis con=pts con0=xterm eth0=daemon,,unix,3904 &
sleep 10
linux ubd0=cow_host32_1,root_fs umid=host32_1 con=pts con0=xterm eth0=daemon,,unix,3903 &
sleep 10
linux ubd0=cow_jupiter,root_fs umid=jupiter con=pts con0=xterm eth0=daemon,,unix,3903 &
echo "|====================|"
echo " 100% done"
echo
;;
config) case "$2" in
gateway) ifconfig lo 127.0.0.1 up
ifconfig eth0 10.126.13.177 netmask 255.255.255.0 broadcast 10.126.13.255
ifconfig eth1 192.168.39.1 netmask 255.255.255.224 broadcast 192.168.39.31
;;
bridge) brctl addbr br0
ifconfig eth0 promisc up
ifconfig eth1 promisc up
brctl addif br0 eth0
brctl addif br0 eth1
brctl stp br0 on
ifconfig br0 192.168.39.2 netmask 255.255.255.0 broadcast 192.168.39.31
;;
mars) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.3 netmask 255.255.255.224 broadcast 192.168.39.31
ifconfig eth1 192.168.39.129 netmask 255.255.255.224 broadcast 192.168.39.159
;;
titan) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.4 netmask 255.255.255.224 broadcast 192.168.39.31
ifconfig eth1 192.168.39.65 netmask 255.255.255.224 broadcast 192.168.39.95
;;
uranus) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.66 netmask 255.255.255.224 broadcast 192.168.39.95
ifconfig eth1 192.168.39.97 netmask 255.255.255.224 broadcast 192.168.39.127
;;
pluto) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.99 netmask 255.255.255.224 broadcast 192.168.39.127
ifconfig eth1 192.168.39.33 netmask 255.255.255.224 broadcast 192.168.39.63
;;
host0_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.5 netmask 255.255.255.224 broadcast 192.168.39.31
;;
saturnus) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.130 netmask 255.255.255.224 broadcast 192.168.39.159
;;
host128_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.131 netmask 255.255.255.224 broadcast 192.168.39.159
;;
host64_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.67 netmask 255.255.255.224 broadcast 192.168.39.95
;;
host96_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.100 netmask 255.255.255.224 broadcast 192.168.39.127
;;
metis) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.98 netmask 255.255.255.224 broadcast 192.168.39.127
;;
host32_1) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.35 netmask 255.255.255.224 broadcast 192.168.39.63
;;
jupiter) ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.39.34 netmask 255.255.255.224 broadcast 192.168.39.63
;;
*) echo "Parameter 2 salah Jeeh!"
echo "1. gateway"
echo "2. bridge"
echo "3. mars"
echo "4. titan"
echo "5. uranus"
echo "6. pluto"
echo "7. host0_1"
echo "8. saturnus"
echo "9. host128_1"
echo "10. host64_1"
echo "11. host96_1"
echo "12. metis"
echo "13. host32_1"
echo "14. jupiter"
;;
esac
;;
routing) case "$2" in
gateway) route add default gw 10.126.13.1
route add -net 192.168.39.128/27 gw 192.168.39.3
route add -net 192.168.39.64/27 gw 192.168.39.4
route add -net 192.168.39.96/27 gw 192.168.39.4
route add -net 192.168.39.32/27 gw 192.168.39.4
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
bridge) route add default gw 192.168.39.1
route add -net 192.168.39.128/27 gw 192.168.39.3
route add -net 192.168.39.64/27 gw 192.168.39.4
route add -net 192.168.39.96/27 gw 192.168.39.4
route add -net 192.168.39.32/27 gw 192.168.39.4
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
mars) route add default gw 192.168.39.1
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
titan) route add default gw 192.168.39.1
route add -net 192.168.39.96/27 gw 192.168.39.66
route add -net 192.168.39.32/27 gw 192.168.39.66
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
uranus) route add default gw 192.168.39.65
route add -net 192.168.39.32/27 gw 192.168.39.99
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
pluto) route add default gw 192.168.39.97
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
host0_1) route add default gw 192.168.39.1
;;
saturnus) route add default gw 192.168.39.129
;;
host128_1) route add default gw 192.168.39.129
;;
host64_1) route add default gw 192.168.39.65
;;
host96_1) route add default gw 192.168.39.97
;;
metis) route add default gw 192.168.39.97
;;
host32_1) route add default gw 192.168.39.33
;;
jupiter) route add default gw 192.168.39.33
;;
*) echo "Parameter 2 salah Jeeh!"
echo "1. gateway"
echo "2. bridge"
echo "3. mars"
echo "4. titan"
echo "5. uranus"
echo "6. pluto"
echo "7. host0_1"
echo "8. saturnus"
echo "9. host128_1"
echo "10. host64_1"
echo "11. host96_1"
echo "12. metis"
echo "13. host32_1"
echo "14. jupiter"
;;
esac
;;
*) echo "Parameter 1 salah jeeeh!"
echo "1. create => buat virtual machine"
echo "2. config => config virtual machine"
echo "3. routing => routing virtual machine"
;;
esac
No comments:
Post a Comment
silahkan membaca dan berkomentar