可設定開機啟動以下指令:
ip addr add 10.222.112.1 dev br0
ip route add 10.222.112.0/24 dev br0
修改iptables:
iptables -t nat -A POSTROUTING -o br0 -s 10.222.112.0/24 -j MASQUERADE
iptables -I INPUT -i br0 -p icmp -s 10.222.112.0/255.255.255.0 -j ACCEPT
修改:
指令:
/etc/qemu-ifup
#!/bin/sh
bridge=br0ifconfig $1 0.0.0.0 promisc up
brctl addif $bridge $1
/etc/qemu-ifdown
#!/bin/sh
bridge=br0
brctl delif $bridge $1 || true
ifconfig $1 down
qemu-system-x86_64 --enable-kvm image_file -m 2048 -smp 2 -netdev tap,id=mynet0 -device virtio-net-pci,netdev=mynet0
在guest內:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:12:34:56
IPADDR=10.222.112.2
GATEWAY=10.222.112.1
NETMASK=255.255.255.0
TYPE=Ethernet
UUID=3f979381-18b8-4a3e-8221-2f8379c8b79a
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
沒有留言:
張貼留言