环境:
Fedora 9 x86_64 @ AMD Athlon X2 5000+
单网卡 (eth0), runlevel 3
角色: Linux NAT、DHCP Server、KVM Host
内容:
开机自动桥接 eth0
让 DHCP Server 由 eth0 改用 br0
使用 cbq.init 限制 LAN User 的下载带宽
KVM on Fedora 9 操作备忘 (Bridge Mode)
开机自动桥接 eth0
yum install bridge-utils
vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
OnBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=xx:xx:xx:xx:xx:xx
OnBOOT=yes
BRIDGE=br0
让 DHCP Server 由 eth0 改用 br0
vi /etc/sysconfig/dhcpd
DHCPDARGS=br0
使用 cbq.init 限制 LAN User 的下载带宽
iptables -t mangle -A FORWARD -o br0 -d 192.168.1.100 -j MARK --set-mark=10
vi /etc/sysconfig/cbq/cbq-0002.test
DEVICE=eth0,100Mbit,10Mbit
RATE=500Kbit
WEIGHT=50Kbit
PRIO=5
MARK=10
KVM on Fedora 9 操作备忘 (Bridge Mode)
yum install kvm qemu
modprobe kvm_amd
ln -s /usr/bin/qemu-kvm /usr/bin/kvm
vi /etc/qemu-ifup
#!/bin/sh
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1
vi /etc/qemu-ifdown
#!/bin/sh
echo Bye.
chmod +x /etc/qemu-if*
qemu-img create -f qcow2 f10.qcow2 10G
kvm -hda f10.qcow2 -cdrom /path/to/Fedora-10-i386-DVD.iso -boot d -m 256 -localtime -net nic -net tap,ifname=tap0 -vnc :1