KVM commandline (on host):
screen -S qemu06 /usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu host -smp 4,cores=4,maxcpus=8 -m 2048 -net nic,model=e1000 -net tap,ifname=tap5,script=no -hda /home/random/qemu/x86/n7cde/cde.vdi -nographic
====
build command (inside VM):
time ./build.sh -x -r -j4 release iso-image
=====
make iso-image started at: Tue Jan 19 18:56:17 AKST 2016
make iso-image finished at: Tue Jan 19 18:57:22 AKST 2016
===> Successful make iso-image
===> build.sh ended: Tue Jan 19 18:57:22 AKST 2016
===> Summary of results:
build.sh command: ./build.sh -x -r -j4 release iso-image
build.sh started: Tue Jan 19 17:11:58 AKST 2016
NetBSD version: 7.0.0_PATCH
MACHINE: amd64
MACHINE_ARCH: x86_64
Build platform: NetBSD 7.0 amd64
HOST_SH: /bin/sh
No $TOOLDIR/bin/nbmake, needs building.
Bootstrapping nbmake
MAKECONF file: /etc/mk.conf
TOOLDIR path: /usr/src/obj/tooldir.NetBSD-7.0-amd64
DESTDIR path: /usr/src/obj/destdir.amd64
RELEASEDIR path: /usr/src/obj/releasedir
Removing /usr/src/obj/tooldir.NetBSD-7.0-amd64
Removing /usr/src/obj/destdir.amd64
Created /usr/src/obj/tooldir.NetBSD-7.0-amd64/bin/nbmake
Updated makewrapper: /usr/src/obj/tooldir.NetBSD-7.0-amd64/bin/nbmake-amd64
Successful make release
Successful make iso-image
build.sh ended: Tue Jan 19 18:57:22 AKST 2016
===> .
6324.10 real 12894.15 user 4787.03 sys
Tuesday, January 19, 2016
Sunday, January 17, 2016
Qemu bridging sorted
My original idea was to put a script in $HOME/bin which would start tap interfaces on demand.
That ran into snags when the echo 1 >/proc commands would give me permission errors.
Then I had the idea -make everything permanent and throw it all into /etc/rc.local.
Not the most elegant solution -but at least now I have six guarenteed tap interfaces to work with!
here's the code to put in /etc/rc.local (warning, make sure your distro supports /etc/rc.local..many newer ones may not);
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
for x in {0..5}
do
tunctl -u random
sudo ip link set tap$x up
echo 1 > /proc/sys/net/ipv4/conf/tap$x/proxy_arp
route add -host 192.168.200.2$x dev tap$x
done
exit 0
===
Rebooted, works for me! So far, at least.
My next problem to work out involves figuring out how to kill headless qemu sessions (x86 doesn't give any output when done with -nographic).
That ran into snags when the echo 1 >/proc commands would give me permission errors.
Then I had the idea -make everything permanent and throw it all into /etc/rc.local.
Not the most elegant solution -but at least now I have six guarenteed tap interfaces to work with!
here's the code to put in /etc/rc.local (warning, make sure your distro supports /etc/rc.local..many newer ones may not);
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
for x in {0..5}
do
tunctl -u random
sudo ip link set tap$x up
echo 1 > /proc/sys/net/ipv4/conf/tap$x/proxy_arp
route add -host 192.168.200.2$x dev tap$x
done
exit 0
===
Rebooted, works for me! So far, at least.
My next problem to work out involves figuring out how to kill headless qemu sessions (x86 doesn't give any output when done with -nographic).
Saturday, January 16, 2016
struggling with qemu bridging
I think I almost have this figured out.
I read these two blogs:
https://shanetomlinson.com/2009/bridging-a-wireless-card-in-kvmqemu/
and
http://blog.bodhizazen.net/linux/bridge-wireless-cards/
Basically I'm creating a new route on a new interface (tap*) and connecting through that.
router=192.168.200.1
Host=192.168.200.100
So, I install everything I need and might need
sudo apt-get install uml-utils bridge-utils
from bodhi's blog;
So far it seems that what that means is that for each virtual machine you want to make, you'll need to make a new tun device and add it's IP to the host machine's routing table.
On the host after each reboot the tun device(s) ..one for each vm.. need to be remade.
So, the important numbers for my configuration;
router: 192.168.200.1
host:192.168.200.100
tap0:192.168.200.20
tap1:192.168.200.21
and so on (tap2 .22;tap3 .23 etc)
So we take the following steps to make a tap device
sudo -s
tunctl -u $USERNAME (note; use your actual username, not "$USERNAME")
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap0 up
route add -host 192.168.200.20 dev tap0
Then in the virtual machine you can use 192.168.200.20 as the IP, 192.168.200.100 as the gateway and 192.168.200.1 as the nameserver.
For example, I have an openbsd/sparc64 VM I've configured thusly;
to make additional tap interfaces you simply re-run the tunctl command, echo 1 to a new /proc.../tapX/proxy_arp, ip link set tapX up and then add the IP you want the new interface to have to the routing table.
For instance, assuming you've already set up tap0, to set up tap1 to have the IP of 192.168.200.30 you'd run the following commands;
sudo -s
tunctl -u $USERNAME
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap1 up
route add -host 192.168.200.30 dev tap1
...and bob's your uncle; your tap1 is ready to use.
After you've set up your interface you can invoke it in qemu by adding the following to your qemu invocation;
-net nic -net tap,ifname=tap0,script=no
I read these two blogs:
https://shanetomlinson.com/2009/bridging-a-wireless-card-in-kvmqemu/
and
http://blog.bodhizazen.net/linux/bridge-wireless-cards/
Basically I'm creating a new route on a new interface (tap*) and connecting through that.
router=192.168.200.1
Host=192.168.200.100
So, I install everything I need and might need
sudo apt-get install uml-utils bridge-utils
from bodhi's blog;
C : Tap. We do not assign a ip address to the tap, rather we assign a route on the host. This route will become the ip address of the guest.This is important to note.
route = 192.168.0.20
So far it seems that what that means is that for each virtual machine you want to make, you'll need to make a new tun device and add it's IP to the host machine's routing table.
On the host after each reboot the tun device(s) ..one for each vm.. need to be remade.
So, the important numbers for my configuration;
router: 192.168.200.1
host:192.168.200.100
tap0:192.168.200.20
tap1:192.168.200.21
and so on (tap2 .22;tap3 .23 etc)
So we take the following steps to make a tap device
sudo -s
tunctl -u $USERNAME (note; use your actual username, not "$USERNAME")
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap0 up
route add -host 192.168.200.20 dev tap0
Then in the virtual machine you can use 192.168.200.20 as the IP, 192.168.200.100 as the gateway and 192.168.200.1 as the nameserver.
For example, I have an openbsd/sparc64 VM I've configured thusly;
/etc/hostname.ne0 contains:
inet 192.168.200.20 255.255.255.0
/etc/mygate contains:
192.168.200.100
/etc/resolv.conf contains:
lookup file bind
nameserver 192.168.200.1 (note, on netbsd I had to change this to 8.8.8.8 in order to work)
to make additional tap interfaces you simply re-run the tunctl command, echo 1 to a new /proc.../tapX/proxy_arp, ip link set tapX up and then add the IP you want the new interface to have to the routing table.
For instance, assuming you've already set up tap0, to set up tap1 to have the IP of 192.168.200.30 you'd run the following commands;
sudo -s
tunctl -u $USERNAME
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap1 up
route add -host 192.168.200.30 dev tap1
...and bob's your uncle; your tap1 is ready to use.
After you've set up your interface you can invoke it in qemu by adding the following to your qemu invocation;
-net nic -net tap,ifname=tap0,script=no
Subscribe to:
Posts (Atom)
automating zfs mounts -a quick and very dirty script
#!/bin/sh for x in obj xsrc src pkgsrc pkgsrc/distfiles pkgsrc/packages pkg do zfs create ext/$x zfs set mountpoint=/usr/$x ext/$x ...
-
Two days after I decided to test the -currents: --- iso_image --- mkdir -p -m 0755 /usr/src/obj/releasedir/images /usr/src/obj/tooldir.Net...
-
KVM commandline (on host): screen -S qemu06 /usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu host -smp 4,cores=4,maxcpus=8 -m 2048 -net ...
-
make iso-image started at: Thu Feb 25 20:50:56 AKST 2021 make iso-image finished at: Thu Feb 25 20:51:03 AKST 2021 ===> Successful make ...