はわわーっ

はわわわわっ

qemuにdebianをインストールする

メモです。

ネットワーク周りのやつ。

% cat /etc/netctl/bridge
Description="Bridge connection"
Interface=br1
Connection=bridge
BindsToInterfaces=(eno1)
IP=dhcp
## Ignore (R)STP and immediately activate the bridge
#SkipForwardingDelay=yes
% ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UP group default qlen 1000
    link/ether 60:a4:4c:64:9a:00 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::62a4:4cff:fe64:9a00/64 scope link
       valid_lft forever preferred_lft forever
3: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 60:a4:4c:64:9a:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.5/24 brd 192.168.0.255 scope global br1
       valid_lft forever preferred_lft forever
    inet6 2408:211:3e2:a300:62a4:4cff:fe64:9a00/64 scope global dynamic
       valid_lft 2591916sec preferred_lft 604716sec
    inet6 fe80::62a4:4cff:fe64:9a00/64 scope link
       valid_lft forever preferred_lft forever
% sudo vde_switch -tap tap0 -daemon -mod 660 -group users
% sudo ip link set tap0 up
% sudo brctl addif br1 tap0
% ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UP group default qlen 1000
    link/ether 60:a4:4c:64:9a:00 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::62a4:4cff:fe64:9a00/64 scope link
       valid_lft forever preferred_lft forever
3: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 60:a4:4c:64:9a:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.5/24 brd 192.168.0.255 scope global br1
       valid_lft forever preferred_lft forever
    inet6 2408:211:3e2:a300:62a4:4cff:fe64:9a00/64 scope global dynamic
       valid_lft 2591985sec preferred_lft 604785sec
    inet6 fe80::62a4:4cff:fe64:9a00/64 scope link
       valid_lft forever preferred_lft forever
4: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UNKNOWN group default qlen 500
    link/ether fe:df:95:f2:38:4e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fcdf:95ff:fef2:384e/64 scope link
       valid_lft forever preferred_lft forever

ディスクイメージを用意してインストール。macアドレスはランダムに生成してみた。

% qemu-img create -f qcow2 koyomin.img 30G
Formatting 'koyomin.img', fmt=qcow2 size=32212254720 encryption=off cluster_size=65536 lazy_refcounts=off
% printf '52:54:%02x:%02x:%02x:%02x\n' $((RANDOM & 0xff)) $((RANDOM & 0xff)) $((RANDOM & 0xff)) $((RANDOM & 0xff))
52:54:6f:16:ce:03
% qemu-system-x86_64 -enable-kvm -daemonize -m 1024 -cdrom debian-7.3.0-amd64-netinst.iso -boot order=d -name koyomin -net nic,macaddr=52:54:6f:16:ce:03 -net vde koyomin.img

起動。

% qemu-system-x86_64 -enable-kvm -daemonize -m 1024 -boot order=c -name koyomin -net nic,macaddr=52:54:6f:16:ce:03 -net vde koyomin.img