我曾经听到这么一个故事: 一个年轻的程序员问一个老程序员(一个比较牛逼的公司的CTO) 年轻程序员: 你为什么这么牛X., 就好像没有你不会的。老程序员: 积累的。年轻程序员: 怎么才能积累到您的程度呢。我每天都在积累。但是似乎都没有感觉到进步。老程序员: 我从20岁开始做到了一件事情,直到今天,而且尽可能地保证不间断。年轻程序员: 到底是什么? 老程序员: 我每天保证自己有2个小时在学习新的东西。

[forward]Fedora 15 Virt manager bridged networking

上一篇 / 下一篇  2011-07-08 16:12:18 / 个人分类:Fedora

From http://blog.bodhizazen.net/linux/fedora-15-virt-manager-bridged-networking/

Fedora 15 Virt manager bridged networking

I recently upgraded my virtual host node from Fedora 13 to Fedora 15 and alas virt-manager / NetworkManager do not yet configure a bridged network device for use with KVM guests.

There have been somechanges to how Fedora names network devicesas well as changing tosystemd, so while the basics are the same, there are some changes to the details.

Dependencies

You will need to have bridge-utils installed, I found it was included when I installed virt-manager.

yum install bridge-utils

Manual configuration

Configure your interfaces by editing the network scripts located in /etc/sysconfig/network-scripts. Take note of the new terminology Fedora is using.

Note: You will lose networking temporarily as you perform. the configuration.

1. Disable NetworkManager. Unfortunately NM does not manage bridges and if you do not disable it , NM will over write your configuration.

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

2. Configure your bridge by adding a file ifcfg-br0 with the contents:

Static IP:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
NBOOT=yes
DELAY=0
IPADDR=192.168.0.10 # Set your IP address here.
NETWORK=192.168.0.0
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
MTU=1500
DNS1=192.168.0.2 # Set your DNS server.
IPV6INIT=no # ipv6 is disabled
USERCTL=no

Or if you prefer to use DHCP:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
NBOOT=yes
DELAY=0

3. Add your network card to the bridge. Here we will add an interface using a file ifcfg-em0

DEVICE=em0
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:11:AA:BB:CC:DD
NBOOT=yes
BRIDGE=br0

3. Enable networking

systemctl start network.service
systemctl enable network.service

Configure iptables

We can add a single rule to allow network packets to be forwarded to the guests.

iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT

# Save your changes
/etc/init.d/iptables save

References

RHEL Documentation – Bridged networking with libvirt

Fedora 15 feature request


TAG:

 

评分:0

我来说两句

Open Toolbar