标签:kvm网桥配置
安装完KVM,默认是用NAT的,我们配置网桥模式,
好了,我们省去多余的,直接开始配置
环境:Red Hat Enterprise Linux Server release 6.5
默认网卡:ifcfg-em1
一、通过配置文件配置桥接设备,配置文件请自行备份
[root@dm01 network-scripts]# cat ifcfg-em1 DEVICE=em1 TYPE=Ethernet UUID=45ed4581-ffea-4a88-8bf9-5784dae9abaa ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none NAME="System em1" HWADDR=F8:BC:12:4D:A4:DA LAST_CONNECT=1427979794 BRIDGE=br0
我们新建ifcfg-br0
[root@dm01 network-scripts]#vi ifcfg-br0 DEVICE=br0 TYPE=Bridge ONBOOT=yes BOOTPROTO=static IPADDR=192.168.1.251 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DEFAULT=yes
参数详解:
ifcfg-eth0
Device 指定网卡设备名
TYPE 指定网卡的类型为以太网卡
ONBOOT 指定网卡是否开机启动,切记要设置为yes
BRIDGE 指定桥接设备,此处指定为br0设备
建议:以上变量(非变量值)均为大写。
ifcfg-br0
Device 指定网卡设备名
TYPE 指定网卡的类型为桥接
ONBOOT 指定网卡是否开机启动,切记要设置为yes
BOOTPROTO 指定网卡启动如何获取IP地址,设置静态
IPADDR 设置br0绑定的IP地址
NETMASK 设置子网掩码地址
GATEWAY 设置网关
二、建议停止NetworkManager 服务,这个服务挺讨厌
[root@master ~]# service NetworkManager stop [root@master ~]#chkconfig NetworkManager off [root@master ~]# service network restart [root@dm01 network-scripts]# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether f8:bc:12:4d:a4:da brd ff:ff:ff:ff:ff:ff inet6 fe80::fabc:12ff:fe4d:a4da/64 scope link valid_lft forever preferred_lft forever 3: em2: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether f8:bc:12:4d:a4:dc brd ff:ff:ff:ff:ff:ff 12: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether f8:bc:12:4d:a4:da brd ff:ff:ff:ff:ff:ff inet 192.168.1.251/24 brd 192.168.1.255 scope global br0 inet6 fe80::fabc:12ff:fe4d:a4da/64 scope link valid_lft forever preferred_lft forever 13: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500 link/ether fe:54:00:7c:9a:33 brd ff:ff:ff:ff:ff:ff inet6 fe80::fc54:ff:fe7c:9a33/64 scope link valid_lft forever preferred_lft forever 14: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500 link/ether fe:54:00:ad:52:0c brd ff:ff:ff:ff:ff:ff inet6 fe80::fc54:ff:fead:520c/64 scope link valid_lft forever preferred_lft forever
我们已经配置完毕,用以下命令观察下
[root@dm01 network-scripts]# brctl show bridge name bridge id STP enabled interfaces br0 8000.f8bc124da4da no em1 vnet0 vnet1 [root@dm01 network-scripts]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 br0 link-local * 255.255.0.0 U 1012 0 0 br0 default 192.168.1.1 0.0.0.0 UG 0 0 0 br0
好了,KVM网桥已经配置,直接在KVM选择即可使用
本文出自 “xiangcun168” 博客,请务必保留此出处http://xiangcun168.blog.51cto.com/4788340/1663247
标签:kvm网桥配置
原文地址:http://xiangcun168.blog.51cto.com/4788340/1663247