DDR爱好者之家 Design By 杰米
KVM的默认网络模式为NAT,就是说借助宿主机模式上网,现在我们想改成桥接模式,这样外界就可以直接和宿主机里的虚拟机通讯了。
1,首先看一下默认的网络设置
复制代码代码如下:
# cat /etc/libvirt/qemu/networks/default.xml
<network>
<name>default</name>
<uuid>1f118032-0345-4725-adcf-6b94f6aca19c</uuid>
<bridge name="virbr0" />
<mac address='52:54:00:F1:6B:6E'/>
<forward/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
</network>
2,再看一下虚拟机配置文件里面的网络设置
#cat /etc/libvirt/qemu/ubuntu10.04.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ubuntu10.04
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>ubuntu10.04</name>
<uuid>2eeb1395-39a2-a169-4da3-f22b20a1d34f</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='rhel6.3.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/ubuntu10.04.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'> 原来是interface type='default'
<mac address='52:54:00:50:58:7e'/>
<source bridge='br1'/> 原来是source network='default',这里的br1要根据你的物理网卡下面有讲
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
[/code]
3,改完之后要更新一下配置文件
# virsh define ubuntu10.04.xml
定义域 ubuntu10.04(从 ubuntu10.04.xml)
#然后就可以virsh start ubuntu10.04了,不过现在物理网卡这块还没有改好
4,物理网卡可以手动更改,不过现在有现成的工具包,可以用这个更改
#wget http://www.convirture.com/downloads/convirture-tools/2.0.1/convirture-tools-2.0.1.tar.gz
# tar zxvf convirture-tools-2.0.1.tar.gz
# /root/convirture-tools/install/managed_server/scripts/convirt-tool --bridge setup
我的这里出现了点小问题,发现网络没起来,所以不要远程来做这个操作,主要原因是里面的配置文件有点需要
小的更改,我的是UUID注释了。
# ls ifcfg-*
ifcfg-br1 ifcfg-br2 ifcfg-br3 ifcfg-br4 ifcfg-em1 ifcfg-em2 ifcfg-em3 ifcfg-em4 ifcfg-lo
我这里有四个物理网卡,所以生成了四个bridge,不过真实用的只有br1
这个工具好有一个好处就是保存了原配置文件,如果你不想用时还可以还原
# ls saved.ifcfg-em*
saved.ifcfg-em1.20121128.101114 saved.ifcfg-em3.20121128.101114
saved.ifcfg-em2.20121128.101114 saved.ifcfg-em4.20121128.101114
看下ifceg-em1
# cat ifcfg-em1
DEVICE="em1"
#BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
#UUID="3bc7fdcc-42b1-4223-b202-e697305897c8"
#IPADDR172.16.10.81
PREFIX=24
GATEWAY=172.16.10.254
DNS1=172.16.10.5
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System em1"
HWADDR=90:B1:1C:20:4D:A5
BRIDGE=br1
看下ifcfg-br1
# cat ifcfg-br1
DEVICE="br1"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
#UUID="3bc7fdcc-42b1-4223-b202-e697305897c8"
IPADDR=172.16.10.81
PREFIX=24
GATEWAY=172.16.10.254
DNS1=172.16.10.5
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br1"
TYPE=Bridge
最后看下网卡
# ifconfig
br1 Link encap:Ethernet HWaddr 90:B1:1C:20:4D:A5
inet addr:172.16.10.81 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::92b1:1cff:fe20:4da5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10219 errors:0 dropped:0 overruns:0 frame:0
TX packets:3776 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:576031 (562.5 KiB) TX bytes:15928008 (15.1 MiB)
em1 Link encap:Ethernet HWaddr 90:B1:1C:20:4D:A5
inet6 addr: fe80::92b1:1cff:fe20:4da5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10362 errors:0 dropped:0 overruns:0 frame:0
TX packets:13131 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:766684 (748.7 KiB) TX bytes:16489098 (15.7 MiB)
Interrupt:35
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:144411 errors:0 dropped:0 overruns:0 frame:0
TX packets:144411 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:147381248 (140.5 MiB) TX bytes:147381248 (140.5 MiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:F1:6B:6E
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2028 errors:0 dropped:0 overruns:0 frame:0
TX packets:1135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:233311 (227.8 KiB) TX bytes:89372 (87.2 KiB)
vnet0 Link encap:Ethernet HWaddr FE:54:00:50:58:7E
inet6 addr: fe80::fc54:ff:fe50:587e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:3117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:15533 (15.1 KiB) TX bytes:263947 (257.7 KiB)
vnet1 Link encap:Ethernet HWaddr FE:54:00:B5:1A:19
inet6 addr: fe80::fc54:ff:feb5:1a19/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:56 errors:0 dropped:0 overruns:0 frame:0
TX packets:794 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:8754 (8.5 KiB) TX bytes:42245 (41.2 KiB)
5,启动虚拟机ubuntu10.04后配置网卡
#cat /etc/network/interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.16.10.100
netmask 255.255.255.0
gateway 172.16.10.254
#/etc/init.d/networking restart
启动即可
1,首先看一下默认的网络设置
复制代码代码如下:
# cat /etc/libvirt/qemu/networks/default.xml
<network>
<name>default</name>
<uuid>1f118032-0345-4725-adcf-6b94f6aca19c</uuid>
<bridge name="virbr0" />
<mac address='52:54:00:F1:6B:6E'/>
<forward/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
</network>
2,再看一下虚拟机配置文件里面的网络设置
#cat /etc/libvirt/qemu/ubuntu10.04.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ubuntu10.04
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>ubuntu10.04</name>
<uuid>2eeb1395-39a2-a169-4da3-f22b20a1d34f</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='rhel6.3.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/ubuntu10.04.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'> 原来是interface type='default'
<mac address='52:54:00:50:58:7e'/>
<source bridge='br1'/> 原来是source network='default',这里的br1要根据你的物理网卡下面有讲
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
[/code]
3,改完之后要更新一下配置文件
# virsh define ubuntu10.04.xml
定义域 ubuntu10.04(从 ubuntu10.04.xml)
#然后就可以virsh start ubuntu10.04了,不过现在物理网卡这块还没有改好
4,物理网卡可以手动更改,不过现在有现成的工具包,可以用这个更改
#wget http://www.convirture.com/downloads/convirture-tools/2.0.1/convirture-tools-2.0.1.tar.gz
# tar zxvf convirture-tools-2.0.1.tar.gz
# /root/convirture-tools/install/managed_server/scripts/convirt-tool --bridge setup
我的这里出现了点小问题,发现网络没起来,所以不要远程来做这个操作,主要原因是里面的配置文件有点需要
小的更改,我的是UUID注释了。
# ls ifcfg-*
ifcfg-br1 ifcfg-br2 ifcfg-br3 ifcfg-br4 ifcfg-em1 ifcfg-em2 ifcfg-em3 ifcfg-em4 ifcfg-lo
我这里有四个物理网卡,所以生成了四个bridge,不过真实用的只有br1
这个工具好有一个好处就是保存了原配置文件,如果你不想用时还可以还原
# ls saved.ifcfg-em*
saved.ifcfg-em1.20121128.101114 saved.ifcfg-em3.20121128.101114
saved.ifcfg-em2.20121128.101114 saved.ifcfg-em4.20121128.101114
看下ifceg-em1
# cat ifcfg-em1
DEVICE="em1"
#BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
#UUID="3bc7fdcc-42b1-4223-b202-e697305897c8"
#IPADDR172.16.10.81
PREFIX=24
GATEWAY=172.16.10.254
DNS1=172.16.10.5
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System em1"
HWADDR=90:B1:1C:20:4D:A5
BRIDGE=br1
看下ifcfg-br1
# cat ifcfg-br1
DEVICE="br1"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
#UUID="3bc7fdcc-42b1-4223-b202-e697305897c8"
IPADDR=172.16.10.81
PREFIX=24
GATEWAY=172.16.10.254
DNS1=172.16.10.5
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br1"
TYPE=Bridge
最后看下网卡
# ifconfig
br1 Link encap:Ethernet HWaddr 90:B1:1C:20:4D:A5
inet addr:172.16.10.81 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::92b1:1cff:fe20:4da5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10219 errors:0 dropped:0 overruns:0 frame:0
TX packets:3776 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:576031 (562.5 KiB) TX bytes:15928008 (15.1 MiB)
em1 Link encap:Ethernet HWaddr 90:B1:1C:20:4D:A5
inet6 addr: fe80::92b1:1cff:fe20:4da5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10362 errors:0 dropped:0 overruns:0 frame:0
TX packets:13131 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:766684 (748.7 KiB) TX bytes:16489098 (15.7 MiB)
Interrupt:35
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:144411 errors:0 dropped:0 overruns:0 frame:0
TX packets:144411 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:147381248 (140.5 MiB) TX bytes:147381248 (140.5 MiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:F1:6B:6E
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2028 errors:0 dropped:0 overruns:0 frame:0
TX packets:1135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:233311 (227.8 KiB) TX bytes:89372 (87.2 KiB)
vnet0 Link encap:Ethernet HWaddr FE:54:00:50:58:7E
inet6 addr: fe80::fc54:ff:fe50:587e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:3117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:15533 (15.1 KiB) TX bytes:263947 (257.7 KiB)
vnet1 Link encap:Ethernet HWaddr FE:54:00:B5:1A:19
inet6 addr: fe80::fc54:ff:feb5:1a19/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:56 errors:0 dropped:0 overruns:0 frame:0
TX packets:794 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:8754 (8.5 KiB) TX bytes:42245 (41.2 KiB)
5,启动虚拟机ubuntu10.04后配置网卡
#cat /etc/network/interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.16.10.100
netmask 255.255.255.0
gateway 172.16.10.254
#/etc/init.d/networking restart
启动即可
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年12月29日
2024年12月29日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]