Skip to content

Instantly share code, notes, and snippets.

@rodrigojusto
Created June 29, 2019 02:05
Show Gist options
  • Save rodrigojusto/684308f6d65ac86a3c845912cee86789 to your computer and use it in GitHub Desktop.
Save rodrigojusto/684308f6d65ac86a3c845912cee86789 to your computer and use it in GitHub Desktop.
EVE-NG - OpenWRT x86
EVE-NG “linux-”
root@eve-ng:~# mkdir /opt/unetlab/addons/qemu/linux-openwrt
root@eve-ng:~# qemu-img create -f qcow2 hda.qcow2 1G
Formatting 'hda.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
root@eve-ng:~# ll
-rw-r--r-- 1 root root 42281968 Aug 12 02:23 hda.qcow2
-rw-r--r-- 1 root root 42281968 Aug 12 02:19 openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img.gz
root@eve-ng:~# gzip -d openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img.gz
root@eve-ng:~# ll
-rw-r--r-- 1 root root 42281968 Aug 12 02:23 hda.qcow2
-rw-r--r-- 1 root root 248844387 Aug 12 02:19 openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img
root@eve-ng:~# dd if=openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img of=hda.qcow2
486024+1 records in
486024+1 records out
248844387 bytes (249 MB, 237 MiB) copied, 1.41203 s, 176 MB/s
root@eve-ng:~# mv hda.qcow2 /opt/unetlab/addons/qemu/linux-openwrt/
skipd[4325]: can't create table 14: unable to open database file
root@(none):/# ll /etc/config/
-rw-rw-r-- 1 root root 2845 Jul 4 01:51 mwan3
-rw------- 1 root root 2153 Jul 4 01:51 nlbwmon
-rw-r--r-- 1 root root 121 Jul 4 01:51 p910nd
root@(none):/# touch /etc/config/network
touch: /etc/config/network: No space left on device
root@(none):/# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 36.8M 36.8M 0 100% /rom
tmpfs 245.8M 96.0K 245.7M 0% /tmp
/dev/loop0 61.0K 11.0K 46.0K 19% /overlay
overlayfs:/overlay 61.0K 11.0K 46.0K 19% /
/dev/sda1 196.8M 3.5M 189.4M 2% /boot
/dev/sda1 196.8M 3.5M 189.4M 2% /boot
tmpfs 512.0K 0 512.0K 0% /dev
root@(none):/# fdisk -l
Disk /dev/loop0: 68.5 KiB, 70144 bytes, 137 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 237.3 MiB, 248844800 bytes, 486025 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9cfbe460
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 512 410111 409600 200M 83 Linux
/dev/sda2 410624 1434623 1024000 500M 83 Linux
root@eve-ng:~# dd if=openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img of=hda.qcow2
486024+1 records in
486024+1 records out
248844387 bytes (249 MB, 237 MiB) copied, 1.54757 s, 161 MB/s
root@eve-ng:~# qemu-img info hda.qcow2
image: hda.qcow2
file format: raw
virtual size: 237M (248844800 bytes)
disk size: 237M
root@eve-ng:~# qemu-img resize hda.qcow2 +750M
WARNING: Image format was not specified for 'hda.qcow2' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
Image resized.
root@eve-ng:~# ll
-rw-r--r-- 1 root root 1035276800 Aug 12 04:06 hda.qcow2
Lan IP: 192.168.1.1/24
root@Openwrt:/# vim /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fddc:9d6e:885b::/48'
config interface 'lan'
option type 'bridge'
option ifname 'eth0 eth1 eth2 eth3'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
LAN IP: 192.168.1.1/24
config interface 'wan'
option ifname 'eth4'
option proto 'dhcp'
config interface 'wan6'
option ifname 'eth4'
option proto 'dhcpv6'
config interface 'lan'
option type 'bridge'
option ifname 'eth0 eth1 eth2 eth3'
option proto 'static'
option ipaddr '10.55.55.25'
option netmask '255.255.255.224'
option ip6assign '60'
option gateway '10.55.55.1'
option broadcast '255.255.255.255'
option dns '114.114.114.114 8.8.8.8'
root@Openwrt:/# service network restart
root@Openwrt:/# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: seq=0 ttl=66 time=26.109 ms
64 bytes from 114.114.114.114: seq=1 ttl=69 time=25.583 ms
64 bytes from 114.114.114.114: seq=2 ttl=91 time=25.252 ms
^C
--- 114.114.114.114 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 25.252/25.648/26.109 ms
root@Openwrt:/# ping baidu.com
PING baidu.com (123.125.115.110): 56 data bytes
64 bytes from 123.125.115.110: seq=0 ttl=51 time=43.248 ms
64 bytes from 123.125.115.110: seq=1 ttl=51 time=43.957 ms
64 bytes from 123.125.115.110: seq=2 ttl=51 time=43.682 ms
64 bytes from 123.125.115.110: seq=3 ttl=51 time=43.305 ms
^C
--- baidu.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/
root@Openwrt:/# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 36.8M 36.8M 0 100% /rom
tmpfs 245.8M 860.0K 244.9M 0% /tmp
/dev/loop0 461.3M 24.9M 342.4M 7% /overlay
overlayfs:/overlay 461.3M 24.9M 342.4M 7% /
/dev/sda1 196.8M 3.5M 189.4M 2% /boot
/dev/sda1 196.8M 3.5M 189.4M 2% /boot
tmpfs 512.0K 0 512.0K 0% /dev
root@Openwrt:/# fdisk -l
Disk /dev/loop0: 463.3 MiB, 485752832 bytes, 948736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 987.3 MiB, 1035276800 bytes, 2022025 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9cfbe460
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 512 410111 409600 200M 83 Linux
/dev/sda2 410624 1434623 1024000 500M 83 Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment