LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 11-04-2015, 03:53 AM   #1
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Rep: Reputation: 1
[SOLVED] KVM on Hetzner with bridged network


Hi

I have a root server at Hetzner.
I received 2 additional dedicated IPs.
Main IP: 5.5.15.132
Second IP: 5.5.15.151
Third IP: 5.5.11.226

I used the following post to set the first IP up with br0:
http://blog.alexdpsg.net/898/

This works very well for the first vm.

But I don't understand how I connect the second IP to the second VM.

I duplicated the br0.xml to br1.xml:
Code:
<network>
  <name>br1</name>
  <uuid>66ae947c-bfb3-4c7b-8d66-af3ea3cc3ba2</uuid>
  <forward dev='eth0' mode='route'>
    <interface dev='eth0'/>
  </forward>
  <bridge name='br1' stp='on' delay='0'/>
  <mac address='52:54:00:65:11:23'/>
  <ip address='5.5.11.226' netmask='255.255.255.254'>
  </ip>
</network>
and I used virsh to define the bridge
Code:
virsh net-define br0.xml
virsh net-start br0
brctl show gives me the following
Code:
bridge name     bridge id               STP enabled     interfaces
br0             8000.5404a6f16f10       yes             eth0
                                                        vnet0
                                                        vnet1
br1             8000.000000000000       yes
From what I understand both vnet go over the same bridge.
How can I configure vnet1 to connect over br1?

Or do I have to add the second IP to the same br0 interface?
And if yes how do I do that?

Thanks!

Last edited by torusJKL; 11-06-2015 at 12:51 PM. Reason: solved
 
Old 11-04-2015, 05:28 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
How can I configure vnet1 to connect over br1?
What you really want, I think, is not plugging a virtual network interface into the br1 bridge, but rather a virtual machine into the br1 network. The brctl output indicates that this hasn't happened yet.

If you really need vnet1 to be connected to br1, create a VM including this XML snippet (based on the libvirt documentation):
Code:
    <interface type='network'>
      <source network='br1' />
      <target dev='vnet1'/>
      <mac address="00:11:22:33:44:55"/>
      ....
However, vnet1 is already in use, it would seem, so I don't think this will succeed.

Edit: Using the same names for your libvirt networks as for the bridges is a bit confusing. Consider naming the networks something like net_br0 etc.

Last edited by berndbausch; 11-04-2015 at 05:30 AM.
 
Old 11-04-2015, 07:11 AM   #3
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 1
Thanks for your reply.
I know have vnet1 connected to br1
Code:
bridge name     bridge id               STP enabled     interfaces
br0             8000.5404a6f16f10       yes             eth0
                                                        vnet0
br1             8000.fe540065cc44       yes             vnet1
But htere is still no network connection on the second vm.
Maybe because br1 is not connected to eth0? How would I create this connection?

Last edited by torusJKL; 11-04-2015 at 07:14 AM.
 
Old 11-04-2015, 07:19 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
To be honest, I am not quite sure how libvirt implements your configuration, but if eth0 is plugged into br0, I doubt it can also be plugged into br1. Thus no connectivity.

It's not quite clear what you want to achieve. You have a physical server and a few IP addresses. Do you want to assign those IP addresses to the VMs you run on the physical server?

This should work with a single bridged (not routed) libvirt network. Just plug both VMs into that network and configure them to use the other two IP addresses. This will basically extend the network outside of your physical server into the server, so that the VMs are directly plugged into the outside network.
See http://libvirt.org/formatnetwork.html#examplesBridge.
 
Old 11-05-2015, 12:16 AM   #5
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 1
I didn't get the the bridge and the eth device have a 1:1 connection.

Could it be that the second IP does not work because it is in a different subnet?
This is how the hosts interfaces is configured:
Code:
# Loopback device:
auto lo
iface lo inet loopback

# device: eth0
auto  br0
iface br0 inet static
  address   5.5.15.132
  netmask   255.255.255.224
  gateway   5.5.15.129
   bridge_ports eth0
   bridge_stp on
   bridge_fd 0
iface br0 inet6 static
  address 2a01:2f4:222:101d::2
  netmask 64
  gateway fe80::1
Would I need to change the netmask?

Thanks!
 
Old 11-05-2015, 01:58 AM   #6
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 1
I changed the netmask on the host interfaces configuration to
Code:
netmask 255.255.0.0
and this seems to help.
I can now ping the host and the first vm and vice versa.

But I can't ping a domain name and I can't access the vm from the outside (using ssh).

Somehow the ping results also look different.
on the working vm1 I see the ping coming from the non working vm2
Code:
ping 5.5.11.226
PING 5.5.11.226 (5.5.11.226) 56(84) bytes of data.
64 bytes from 5.5.11.226: icmp_seq=1 ttl=63 time=0.366 ms
But if I ping from the vm2 I get the result from the main IP:
Code:
ping 5.5.15.151
PING 5.5.15.151 (5.5.15.151) 56(84) bytes of data.
From 5.5.15.132: icmp_seq=1 Redirect Host(New nexthop: 5.5.15.132)
64 bytes from 5.5.11.226: icmp_seq=1 ttl=63 time=0.382 ms
Is this redirection the problem?

Last edited by torusJKL; 11-05-2015 at 01:59 AM. Reason: typo
 
Old 11-05-2015, 04:39 AM   #7
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 1
ip addr show br0
Code:
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 54:04:a6:f1:6f:10 brd ff:ff:ff:ff:ff:ff
    inet 5.5.15.132/16 brd 5.5.255.255 scope global br0
       valid_lft forever preferred_lft forever
ip route
Code:
default via 5.5.15.129 dev br0
5.5.0.0/16 dev br0  proto kernel  scope link  src 5.5.15.132

Last edited by torusJKL; 11-06-2015 at 10:08 AM. Reason: added ip route and ip addr show br0 outputs
 
Old 11-06-2015, 12:51 PM   #8
torusJKL
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 1
I forgot to define the correct mac address in the vm.xml
It now works. :-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ping OK - dig OK - tcp FAIL <KVM bridged network> ericson007 Linux - Networking 3 08-11-2015 09:14 AM
Is there an easier way to do bridged networking with KVM? Red Squirrel Linux - Virtualization and Cloud 45 06-16-2014 07:07 PM
[SOLVED] Networking using bridged interfaces to KVM guests midorikawa Linux - Networking 1 12-19-2013 05:17 PM
[SOLVED] Centos 6 and KVM - how to setup bridged networking in KVM in a -Class B- environment? rylan76 Linux - Virtualization and Cloud 7 11-07-2012 06:46 AM
QEMU KVM bridged networking? iwanttolickazunyan Linux - Virtualization and Cloud 8 05-04-2012 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 08:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration