just referred to http://kashyapc.wordpress.com/2013/07/13/configuring-libvirt-guests-with-an-open-vswitch-bridge/
# cat /etc/fedora-release ;uname -ri
Fedora release 19 (Schrödinger’s Cat)
3.11.1-200.fc19.x86_64 x86_64
|
Fedora 19 box has one NIC called p10p1.
p10p1 gets IP address over DHCP.
# cat /etc/sysconfig/network-scripts/ifcfg-p10p1
DEVICE=p10p1
ONBOOT=yes
#BRIDGE=br0
BOOTPROTO=dhcp
#
|
install open vswitch via yum
# yum install openvswitch
|
start open vswitch
[root@localhost ~]# systemctl enable openvswitch.service
ln -s '/usr/lib/systemd/system/openvswitch.service' '/etc/systemd/system/multi-user.target.wants/openvswitch.service'
[root@localhost ~]# systemctl start openvswitch.service
[root@localhost ~]# systemctl status openvswitch.service
openvswitch.service - Open vSwitch Unit
Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; enabled)
Active: active (exited) since 月 2013-09-30 00:09:20 JST; 5s ago
Process: 4117 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
|
configure open vswitch bridge
# ovs-vsctl add-br ovsbr0
|
associate ovsbr0 to phsical interface p10p1
Please note that you will lost internet connectivity after issuing following command.
# ovs-vsctl add-port ovsbr0 p10p1
|
after issuing following commands, you will get internet connectivity again.
[root@localhost ~]# ifconfig p10p1 0.0.0.0
[root@localhost ~]# ifconfig ovsbr0 192.168.11.100
[root@localhost ~]# dhclient ovsbr0 &
[1] 4206
# ip addr show dev ovsbr0
8: ovsbr0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 78:e7:d1:7f:84:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.100/24 brd 192.168.11.255 scope global ovsbr0
valid_lft forever preferred_lft forever
inet 192.168.11.5/24 brd 192.168.11.255 scope global secondary ovsbr0
valid_lft forever preferred_lft forever
inet6 fe80::e8ec:5aff:fe59:8655/64 scope link
valid_lft forever preferred_lft forever
[root@localhost ~]#
[1]+ 終了 dhclient ovsbr0
[root@localhost ~]# ovs-vsctl show
6e8e87c4-700b-4556-b977-cc3fa103d893
Bridge "ovsbr0"
Port "p10p1"
Interface "p10p1"
Port "ovsbr0"
Interface "ovsbr0"
type: internal
|
edit VM’s xml file to use open vswitch.
# virsh dumpxml f19-vm1
<interface type='bridge'>
<mac address='52:54:00:d0:86:2e'/>
<source bridge='ovsbr0'/>
<virtualport type='openvswitch'>
|
start the VM
# virsh start f19-vm1
|
on the VM, confirm that the VM gets an IP address over DHCP.
[root@localhost ~]# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:d0:86:2e brd ff:ff:ff:ff:ff:ff
inet 192.168.11.11/24 brd 192.168.11.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fed0:862e/64 scope link
valid_lft forever preferred_lft forever
[root@localhost ~]#
[root@localhost ~]# ping www.google.com -c 1
PING www.google.com (173.194.38.114) 56(84) bytes of data.
64 bytes from nrt19s18-in-f18.1e100.net (173.194.38.114): icmp_seq=1 ttl=53 time=11.2 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.256/11.256/11.256/0.000 ms
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.