KVM network problem.
Hi,
I'm having problems with the network in Cent OS 6.0. My Cent OS 6.0 host has IP 192.168.10.40. The gateway 192.168.10.1. I want to create a Cent OS 6.0 guest with IP 192.168.10.41, so that all the clients on network 192.168.10.x can access this virtual server with ssh/telnet. Is this not possible ? I can't get it to work. In Cent OS 5.7 it just worked out of the box. Because xen was with bridge network as default. Now in kvm its NAT. Så I just get a DHCP adress of something like 192.168.122.x. So I have found out, that I must define a bridge network i kvm. But how ? I've read the RH Virtualization doc and don't find the solution there and googlet alot. Help will be apreciated. Regards Thomas |
create /etc/sysconfig/network-scripts/ifcfg-br0 by copying it from /etc/sysconfig/network-scripts/ifcfg-eth0 then edit both files to match what you need, something like I have listed below
/etc/sysconfig/network-scripts/ifcfg-br0 Code:
DEVICE="br0" /etc/sysconfig/network-scripts/ifcfg-eth0 Code:
DEVICE="eth0" |
Thans :-) So simple, when seeing it.
Many thanks. It works now ! Regards |
Quote:
|
When you create the file for br0 as above and restart the network on the host machine then /dev/br0 becomes available as a bridged network interface It will effectively replace eth0 on the host machine as the network interface.
When you create a guest virtual machine you can select br0 as the interface for the guest system to connect through. (I have only done this with virt-manager - it will be available to select within the properties of the guest networking device). The network interface in the guest machine can be given an IP address which is in the same subnet as the host machine and it will function in the network as if it was a physical machine within the network. I hope this helps make it more clear |
Thats very helpful, Greenfuse. Thanks.
So does anyone know what the qemu -net option would look like in order to get your vm to use this interface? I'm obviously not using virt-manager... |
ok, I answered my own question. For those of use not using virt-manager, you still need to create a virtual interface (tap0) and add it to the bridge (br0) using the bridge-utils and tunctl packages. I use a script to do this right before the VM starts.
Code:
#!/bin/sh I wrote this all up in more detail here: http://www.kevitivity.com/2011/10/br...with-kvm-qemu/ |
I have a question - do you need to create a brX for each VM if you want each one to have its own IP address?
|
Hi,
No you don't need to. |
Just need to make sure I understand. in the ifcfg-br0 you set an IP address. If I were to have 5 VMs all running at the same time connected to br0, they could all have different IPs addresses that everyone in the network could address?
|
think of br0 as the switch, the other vms are plugged into. it's own ip belongs to the host, not the vms
|
OH, that makes a lot more sense. Now if only the br0 could work nicely with network manager, I'd be in business!
|
No, NM is a bad bad bad idea when working with bridges. Just set everything up manually, and let it work.
|
yeah, I get that. But it'd be nice if it would work correclty
|
All times are GMT -5. The time now is 07:19 PM. |