Difference between revisions of "VirtualBox: Instalasi OpenWRT image"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (Created page with "Sumber: https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm This document describes how to run the x86-64 OpenWrt images in VirtualBox, or VB for short. Pre...") |
Onnowpurbo (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
+ | Untuk menginstalasi OpenWRT image ke VirtualBox. Asumsinya adalah, | ||
+ | * VirtualBox sudah di instalasi | ||
+ | * Download dari https://downloads.openwrt.org/releases/18.06.1/targets/ atau buat sendiri file | ||
+ | openwrt-x86-64-combined-squashfs.img | ||
+ | openwrt-x86-64-combined-ext4.img | ||
− | + | * Dari hasil compile | |
− | |||
− | + | openwrt-x86-generic-combined-ext4.img.gz | |
− | + | gunzip openwrt-x86-generic-combined-ext4.img.gz | |
− | |||
− | |||
+ | Convert agar menjadi .vmdk atau .vdi untuk VirtualBox | ||
− | + | vboxmanage convertfromraw --format VMDK openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vmdk | |
+ | vboxmanage convertfromraw --format VDI openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vdi | ||
− | + | Di VirtualBox masuk ke menu | |
− | + | * New | |
− | + | Name: OpenWRT (misalnya) | |
− | + | Type: Linux | |
− | + | Version: Other Linux (64bit) | |
+ | * Memory Size > Next | ||
+ | * Hard Disk > Use an existing virtual harddrive file > Select | ||
− | + | Boot ke mesin OpenWRT, cek | |
− | |||
− | + | root@openwrt:~# uci show network | |
+ | network.loopback=interface | ||
+ | network.loopback.ifname='lo' | ||
+ | network.loopback.proto='static' | ||
+ | network.loopback.ipaddr='127.0.0.1' | ||
+ | network.loopback.netmask='255.0.0.0' | ||
+ | network.globals=globals | ||
+ | network.globals.ula_prefix='fd1b:e541:8f1a::/48' | ||
+ | network.lan=interface | ||
+ | network.lan.type='bridge' | ||
+ | network.lan.ifname='eth0' | ||
+ | network.lan.proto='static' | ||
+ | network.lan.netmask='255.255.255.0' | ||
+ | network.lan.ip6assign='60' | ||
+ | network.lan.ipaddr='192.168.1.1' | ||
+ | network.wan=interface | ||
+ | network.wan.ifname='eth1' | ||
+ | network.wan.proto='dhcp' | ||
+ | network.wan6=interface | ||
+ | network.wan6.ifname='eth1' | ||
+ | network.wan6.proto='dhcpv6' | ||
− | + | Note default LAN address 192.168.1.1 saat booting pertama kali, bisa di ubah menggunakan misalnya | |
− | |||
− | + | uci set network.lan.ipaddr='192.168.56.2' | |
− | + | uci commit | |
+ | reboot | ||
− | + | VM bisa di akses dengan SSH, user root (tanpa password) ke address 192.168.56.2 | |
− | + | Setelah login kita dapat melakukan konfigurasi sebenarnya, misalnya | |
− | + | uci batch <<EOF | |
+ | set network.mng=interface | ||
+ | set network.mng.type='bridge' | ||
+ | set network.mng.proto='static' | ||
+ | set network.mng.netmask='255.255.255.0' | ||
+ | set network.mng.ifname='eth0' | ||
+ | set network.mng.ipaddr='192.168.56.2' | ||
+ | delete network.lan | ||
+ | delete network.wan6 | ||
+ | set network.wan=interface | ||
+ | set network.wan.ifname='eth1' | ||
+ | set network.wan.proto='dhcp' | ||
+ | EOF | ||
− | + | Tulis uci changes konfigurasi harus sama dengan di atas | |
− | + | root@openwrt:~# uci changes | |
+ | network.mng='interface' | ||
+ | network.mng.type='bridge' | ||
+ | network.mng.proto='static' | ||
+ | network.mng.netmask='255.255.255.0' | ||
+ | network.mng.ifname='eth0' | ||
+ | network.mng.ipaddr='192.168.56.2' | ||
+ | -network.lan | ||
+ | -network.wan6 | ||
+ | network.wan='interface' | ||
− | + | Jika semua OK, save config dengan | |
− | |||
− | + | uci commit | |
− | + | reboot | |
− | + | Jika tidak, kita bisa reboot sebelum melakukan uci commit | |
− | |||
− | |||
− | |||
− | + | Untuk bridged adapter di adapter 3, kita bisa melakukan | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | uci batch <<EOF | ||
+ | set network.lan=interface | ||
+ | set network.lan.ifname='eth2' | ||
+ | set network.lan.proto='dhcp' | ||
+ | EOF | ||
+ | uci commit | ||
Latest revision as of 08:58, 18 November 2018
Sumber: https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm
Untuk menginstalasi OpenWRT image ke VirtualBox. Asumsinya adalah,
- VirtualBox sudah di instalasi
- Download dari https://downloads.openwrt.org/releases/18.06.1/targets/ atau buat sendiri file
openwrt-x86-64-combined-squashfs.img openwrt-x86-64-combined-ext4.img
- Dari hasil compile
openwrt-x86-generic-combined-ext4.img.gz gunzip openwrt-x86-generic-combined-ext4.img.gz
Convert agar menjadi .vmdk atau .vdi untuk VirtualBox
vboxmanage convertfromraw --format VMDK openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vmdk vboxmanage convertfromraw --format VDI openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vdi
Di VirtualBox masuk ke menu
- New
Name: OpenWRT (misalnya) Type: Linux Version: Other Linux (64bit)
- Memory Size > Next
- Hard Disk > Use an existing virtual harddrive file > Select
Boot ke mesin OpenWRT, cek
root@openwrt:~# uci show network network.loopback=interface network.loopback.ifname='lo' network.loopback.proto='static' network.loopback.ipaddr='127.0.0.1' network.loopback.netmask='255.0.0.0' network.globals=globals network.globals.ula_prefix='fd1b:e541:8f1a::/48' network.lan=interface network.lan.type='bridge' network.lan.ifname='eth0' network.lan.proto='static' network.lan.netmask='255.255.255.0' network.lan.ip6assign='60' network.lan.ipaddr='192.168.1.1' network.wan=interface network.wan.ifname='eth1' network.wan.proto='dhcp' network.wan6=interface network.wan6.ifname='eth1' network.wan6.proto='dhcpv6'
Note default LAN address 192.168.1.1 saat booting pertama kali, bisa di ubah menggunakan misalnya
uci set network.lan.ipaddr='192.168.56.2' uci commit reboot
VM bisa di akses dengan SSH, user root (tanpa password) ke address 192.168.56.2
Setelah login kita dapat melakukan konfigurasi sebenarnya, misalnya
uci batch <<EOF set network.mng=interface set network.mng.type='bridge' set network.mng.proto='static' set network.mng.netmask='255.255.255.0' set network.mng.ifname='eth0' set network.mng.ipaddr='192.168.56.2' delete network.lan delete network.wan6 set network.wan=interface set network.wan.ifname='eth1' set network.wan.proto='dhcp' EOF
Tulis uci changes konfigurasi harus sama dengan di atas
root@openwrt:~# uci changes network.mng='interface' network.mng.type='bridge' network.mng.proto='static' network.mng.netmask='255.255.255.0' network.mng.ifname='eth0' network.mng.ipaddr='192.168.56.2' -network.lan -network.wan6 network.wan='interface'
Jika semua OK, save config dengan
uci commit reboot
Jika tidak, kita bisa reboot sebelum melakukan uci commit
Untuk bridged adapter di adapter 3, kita bisa melakukan
uci batch <<EOF set network.lan=interface set network.lan.ifname='eth2' set network.lan.proto='dhcp' EOF uci commit