配置網橋的case

 

step

1. Install latest version bridge-utils in host, you can use 'yum insatll' or 'rpm'.

2. Update the script to enable bridge, include the bridge script and the
physical interface script:
# cat /etc/sysconfig/network-scripts/ifcfg-switch
DEVICE=switch
BOOTPROTO=dhcp
NM_CONTROLED=yes
PEERNTP=yes
ONBOOT=yes
TYPE=Bridge
DELAY=0
# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
ONBOOT=yes
BRIDGE=switch
HWADDR="1c:6f:65:06:b4:2e"
TYPE=Ethernet

3.Enable the configuration, and chech the result:
# ifup em1
# brctl show
# ping $external_host_ip -c 10

4.Configure network script for qemu.
# cat /etc/qemu-ifup
#!/bin/sh
switch=switch
/sbin/ifconfig $1 0.0.0.0 up
/usr/sbin/brctl addif ${switch} $1

5.Enable execution privilege to the script
# chmod +x qemu-ifup


6.Reboot host, and then check the network:
# ifconfig
# ping $external_host_ip -c 10


7.Launch a guest w/ network over bridge, and ping host w/ 10 counts.
-netdev tap,id=tap1,script=/etc/qemu-ifup \
-device virtio-net-pci,netdev=tap1,id=nic1,mac=1a:59:0a:4b:5a:94
Guest# ping $host_ip -c 10


Expected Result


1. After step 1confirm whether bridge-utils is installed
#rpm -q bridge-utils
bridge-utils-1.5-5.el7.x86_64

2. After step3, the bridge interface is set up successfully, mac address of
bridge interface and the physical inter face is same, and can get ip address
of bridge interface.
# brctl show
bridge name    bridge id        STP enabled    interfaces
switch        0080.1c6f6506b42e    no        em1
and the ping successfully, bo pkg lost.


3. After step 6, bridge interface is up, and mac address of bridge interface
and the physical inter face is same, and can get ip address of bridge
interface, the ping successfully, bo pkg lost.

4. After step 7, guest can ip, and ping out successfully w/ no pkg lost.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值