[code]qemu -net nic -net tap[/code]
or
[code]kvm -net nic -net tap[/code]
Under gentoo, in order to use that, we have to:
* kernel requirements:
CONFIG_BRIDGE, CONFIG_TUN must be included (y/m) CONFIG_KVM_INTEL/CONFIG_KVM_AMD must be selected in order to use kvm
CONFIG_IP_PNP and CONFIG_ROOT_NFS must be included to use nfsroot/diskless mounted filesystem. Host side NIC driver must also be compiled into kernel (y).
* user space application:
bridge-utils, qemu/kvm
Networking interface layout:
br0: bridge interface, binded with real IP address for network access. eth0: interface of br0, no IP. tapX: interface of guest, no IP.
NOTE: switch interfaces don't have an IP address.
Network configuration in gentoo:
*) make sure NetworkManager/dhcdbd is not started, network interface must not be managed by NetworkManager. ie:
[code]
$ cd /etc/init.d/ $ ln -s net.lo net.eth0 $ ln -s net.lo net.br0 $ rc-update add net.eth0 default $ rc-update add net.br0 default
[/code]
*) /etc/conf.d/net configration, ie:
[code]
bridge_br0="eth0" config_br0=("dhcp") config_eth0=("null")
[/code]
You have to insert some modules if neccessary like:
[code]
$ modprobe tun kvm_amd
[/code]
Start using qemu/kvm:
[code]
$ kvm -kernel bzImage -append "root=/dev/nfs rw nfsroot=192.168.2.xxx:/home/gentoo-x86 ip=on" -net nic,model=e1000 -net tap
[/code]
Note: kvm have it's own network startup/stop scripts /etc/kvm/kvm-if{up,down} in gentoo, if you're using qemu, you have to write your own /etc/qemu-if{up,down} scripts, just copying /etc/kvm/kvm-if{up,down} it's essential.
.refs:
http://www.linuxfoundation.org/en/Net:Bridge gentoo's /etc/conf.d/net.example
No comments:
Post a Comment