Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
libvirt network setup [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Tue Dec 02, 2014 8:23 pm    Post subject: libvirt network setup [solved] Reply with quote

Greeting,

I have a gentoo guest on kvm on gentoo host which can access the internet but cannot see the host.

what is the right config which will maintain current behavior but will be able to see the host?

e.g. a vm that will be visible in the network like it is standalone computer.

Thanks.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein


Last edited by DaggyStyle on Fri Dec 05, 2014 9:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Tue Dec 02, 2014 8:41 pm    Post subject: Reply with quote

oh, man, you are speaking aobut 2 or 3 different things there and I'm not sure which one you want.

Good news is, those things do not really depend or exclude each other, so here are bricks you might need:

1) make use libvirt creates a bridge for your virtual machine. It did for me, but I'm not sure it does with all modes you select.
2a) attach your physical NIC to the bridge to directly attach your VMs to the external network. Physical NIC must not have IP.
2b) configure IP on the brdge to let your host see the VM

use both, b and c to have host and guests attached directly to network.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Dec 03, 2014 6:49 am    Post subject: Reply with quote

szatox wrote:
oh, man, you are speaking aobut 2 or 3 different things there and I'm not sure which one you want.

Good news is, those things do not really depend or exclude each other, so here are bricks you might need:

1) make use libvirt creates a bridge for your virtual machine. It did for me, but I'm not sure it does with all modes you select.
2a) attach your physical NIC to the bridge to directly attach your VMs to the external network. Physical NIC must not have IP.
2b) configure IP on the brdge to let your host see the VM

use both, b and c to have host and guests attached directly to network.


I'll try to explain, I have a windows vm atop of virtual box, when I boot that vm, the router sees it as another computer on the net and allocates it a ip.
see this network example:

  • linux box, ip 192.168.0.1
  • windows laptop, ip 192.168.0.2
  • windows laptop, ip 192.168.0.3
  • windows vm running on the linux box (using VB), ip 192.168.0.4

I want to add the following entry to that list:

  • linux vm running on the linux box (using kvm), ip 192.168.0.5

I was able to do so by passing the using passthrough, the problem is that I was not able to access any box from 192.168.0.5 but I could access 192.168.0.5 from 192.168.0.1
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Thu Dec 04, 2014 7:38 pm    Post subject: Reply with quote

Uhm... So which hypervisor you actually have there, VB or KVM?
I gave you the best short answer I had for KVM, for VB you're out of luck with me.

In the meantime, show us your network configuration on host:
ifconfig
route -n
brctl show

Also, what firewall rules you have on VM host and how you configure network on your guests?
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Dec 04, 2014 9:24 pm    Post subject: Reply with quote

szatox wrote:
Uhm... So which hypervisor you actually have there, VB or KVM?
I gave you the best short answer I had for KVM, for VB you're out of luck with me.

In the meantime, show us your network configuration on host:
ifconfig
route -n
brctl show

Also, what firewall rules you have on VM host and how you configure network on your guests?


I use both but the question is on kvm.
I used my win8 VB vm to explain what I want to achieve.

my current fw rules are broken, haven't had the time to fix it yet.

here are the requested outputs:
Code:


dagg@NCC-5001-D ~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.2  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::52e5:49ff:fe54:5245  prefixlen 64  scopeid 0x20<link>
        ether 50:e5:49:54:52:45  txqueuelen 1000  (Ethernet)
        RX packets 1061642  bytes 1300811567 (1.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 643503  bytes 82892336 (79.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 284  bytes 22590 (22.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 284  bytes 22590 (22.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dagg@NCC-5001-D ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.138      0.0.0.0         UG    4      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     4      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo
dagg@NCC-5001-D ~ $ brctl show
bridge name     bridge id               STP enabled     interfaces


currently I don't have any bridge set.

let me see if I understood you correctly, I need to:

  1. create a bridge and instruct libvirt to use it.
  2. configure ip for both the host and guest on that bridge.


if so, why can't I have the router assign ip to the host and guest?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Dec 05, 2014 9:58 pm    Post subject: Reply with quote

issue solved.

I needed to enable CONFIG_IP_NF_NAT in the kernel, recompile it and run
Code:
sysctl -w net.bridge.bridge-nf-call-iptables=0

_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Schnulli
Guru
Guru


Joined: 25 Jun 2010
Posts: 320
Location: Bremen DE

PostPosted: Mon Dec 08, 2014 11:45 pm    Post subject: Reply with quote

why not to PSX-Boot a VM ?
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Dec 10, 2014 6:52 am    Post subject: Reply with quote

Schnulli wrote:
why not to PSX-Boot a VM ?

PSX? you mean PXE?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Schnulli
Guru
Guru


Joined: 25 Jun 2010
Posts: 320
Location: Bremen DE

PostPosted: Wed Dec 10, 2014 4:10 pm    Post subject: Reply with quote

oops, yes ^^ sorry
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Dec 10, 2014 7:09 pm    Post subject: Reply with quote

Schnulli wrote:
oops, yes ^^ sorry

what's the gain in that?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Wed Dec 10, 2014 8:10 pm    Post subject: Reply with quote

Quote:
what's the gain in that?
Basicaly you would know, if you needed it. You asking this question means there is no benefit for you. As simple as that, it's not worth the effort of setting up DHCP, tftp, nfs, bootloader and perhaps other things unless you KNOW you want it.

However, for sake of satisfying your curiosity the second part comes:
It's good to know such an option exists, so you can have your VM scan some random network you connect to searching for OS provider. Or you can test your plug-and-forget install image for massive deployment on real hardware. Or do something copletly useless like a performance cluster on a single machine which efectively gives you performance of your host reduced by virtualisation overhead (let's say I just enjoy breaking my toys) - so you can run all nodes from a single, shared image. And deal with stuff like not overwriting temporary data from other nodes :)
So, if you ever found a real-life application where you find PXE usefull, it's a neat test environment waiting for you to pick it and use it
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Dec 11, 2014 6:58 am    Post subject: Reply with quote

szatox wrote:
Quote:
what's the gain in that?
Basicaly you would know, if you needed it. You asking this question means there is no benefit for you. As simple as that, it's not worth the effort of setting up DHCP, tftp, nfs, bootloader and perhaps other things unless you KNOW you want it.

However, for sake of satisfying your curiosity the second part comes:
It's good to know such an option exists, so you can have your VM scan some random network you connect to searching for OS provider. Or you can test your plug-and-forget install image for massive deployment on real hardware. Or do something copletly useless like a performance cluster on a single machine which efectively gives you performance of your host reduced by virtualisation overhead (let's say I just enjoy breaking my toys) - so you can run all nodes from a single, shared image. And deal with stuff like not overwriting temporary data from other nodes :)
So, if you ever found a real-life application where you find PXE usefull, it's a neat test environment waiting for you to pick it and use it

I know what PXE is and what is the gain in general (I work with pxe boots in my workplace) but I don't see how this is useful for me or to my issue.

my issue was that gentoo on kvm guest couldn't ssh or even ping the host.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum