_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
ohazot | | docs | | about |
vm
—
configuration, usage and tips
TLDR
vmctl create -s 50G disk.qcow2 vmctl start -m 1G -i 1 -b /bsd -d disk.qcow2 myvm vmctl show #will show mywm vmctl console myvm vmctl stop myvm
TOC
WORKING OS | : OpenBSD, centos, archlinux, opensuse. |
SERIAL CONSOLE | |
INTERNET ACCESS | : vmd.conf |
PORT FORWARDING | : Using pf. |
TODO | |
SEE ALSO |
WORKING OS
OpenBSD, centos, archlinux, opensuse.
SERIAL CONSOLE
Some linux distributions may not have the serial console enabled by default, the following is an example for Slackware lilo.
- On the boot loader press tab.
- type:
huge.s serial 0 115200, console=ttyS0,115200
- to disconnect from the console but keep the vm running: [ENTER] ~^d
- This has been tested on slackware, centos, archlinux, opensuse.
INTERNET ACCESS
host
- allow forwarding.
sysctl net.inet.ip.forwarding=1
- vm.conf:
vm "vm_name" { ... local interface }
- pf.conf : this provides the vm with a dns.
match out on egress from 100.64.0.0/10 to any nat-to (egress) pass in proto { udp tcp } from 100.64.0.0/10 to any port domain rdr-to 192.168.1.1 port domain
- reload pf.conf: after this the vm will have internet access.
pfctl -f /etc/pf.conf
PORT FORWARDING
The vm can be accessed through ssh from the host using the local interface:
ssh 100.64.1.3
- allow external access (pc other than the host) using pf.
pass in on egress proto tcp from any to any port [EXTERNAL_PORT] rdr-to [VM_IP] port [VM_PORT]
- reload pf.conf: after this the vm will be accessible by other machines in
the network.
pfctl -f /etc/pf.conf
example
example | : ssh |
host ip | : 192.168.1.10 |
guest | : 100.64.1.3 |
- pf.conf (on the host):
pass in on egress proto tcp from any to any port 10122 rdr-to 100.64.1.3 port 22
- Reload pf.conf:
pfctl -f /etc/pf.conf
- ssh command:
ssh -p 10122 192.168.1.10
TODO
- test and document real host in the network.
- slackware: unable to load virtio, it doesn't detect vda. This was an issue at some point, needs to be re-tested.
- Verify parameters for other linux distributions.
- Add permanent kernel parameters.
SEE ALSO
OpenBSD manpages
vmctl(8) , vm.conf(5) , vmd(8) , rcctl(8) , pfctl(8) , pf.conf(5)
files
<vm.oh>