DaemonForums  

Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th November 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,254
Thanked 182 Times in 149 Posts
Default KVM Virtual Machine network configuration

These last few days I have been playing with KVM on Linux Mint. Installed an OpenBSD current snapshot, NetBSD and FreeBSD 9.3.

I am using Virtual Machine Manager for managing and installing these virtual machines.

It all works rather well. The only thing I haven't figured out is how to configure the network part in such a way that I can use an external box login over SSH to for example the FreeBSD 9.3 image.

RTFM pointers are welcome, if at least it mentions which FM
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 11th November 2014 at 02:16 AM.
Reply With Quote
  #2   (View Single Post)  
Old 11th November 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,254
Thanked 182 Times in 149 Posts
Default

Thanks to some googling I finally I figured it out. I can now SSH in to the FreeBSD KVM guest under Linux Mint.
Code:
[adriaan@hercules]~: ssh root@192.168.222.244 
Password for root@freebsd_93.utp.xnet:
Last login: Tue Nov 11 02:38:03 2014
FreeBSD 9.3-RELEASE-p5 (GENERIC) #0: Mon Nov  3 22:38:58 UTC 2014

Welcome to FreeBSD!
My first attempt yesterday was to read the RedHat KVM administration guide at https://access.redhat.com/documentat...iguration.html
Although it taught me how to create a virbr0 device, it still did not work. It also mentioned this setup conflicts with NetworkManager, which seems to be some Linux solution to administer the network settings.

Today another google attempt led me to the Ubuntu documentation (Linux Mint is based on Ubuntu) at https://help.ubuntu.com/community/KVM/Networking which provided the necessary background information about the two types of KVM networking:
Quote:
There are a few different ways to allow a virtual machine access to the external network.

The default virtual network configuration is known as Usermode Networking. Traffic is NATed through the host interface to the outside network.

Alternately, you can configure Bridged Networking to enable external hosts to directly access services on the guest operating system.

Usermode Networking

In the default configuration, the guest operating system will have access to network services, but will not be visible to other machines on the network. The guest will be able, for example, to browse the web, but will not be able to host an accessible web server.

By default, the guest OS will get an IP address in the 10.0.2.0/24 address space and the host OS will be reachable at 10.0.2.2.

You should be able to ssh into the host OS (at 10.0.2.2) from inside the guest OS and use scp to copy files back and forth.

If this configuration is suitable for your purposes, no other configuration is required.

If your guests do not have connectivity "out-of-the-box" see Troubleshooting, below.

Bridged Networking

Bridged networking allows the virtual interfaces to connect to the outside network through the physical interface, making them appear as normal hosts to the rest of the network.

Warning: Network bridging will not work when the physical network device (e.g., eth1, ath0) used for bridging is a wireless device (e.g., ipw3945), as most wireless device drivers do not support bridging!
So it was clear that I needed Bridged Networking

The following post allowed me to get it working: Could not ping Solaris KVM Guest from another computer
Quote:
I setup Solaris Guest using KVM in Ubuntu. I don't have problem pinging host (Ubuntu) to guest (Solaris) and vice versa. Also my Solaris guest can ping other computers in my network but not the other way around.
The person having the problem updated his question with the Ubuntu /etc/network/interfaces contents that solved his issue

My version of that file:
Code:
# interfaces(5) file used by ifup(8) and ifdown(8)

# loopback
auto lo
iface lo inet loopback

# eth0 interface
auto eth0
iface eth0 inet dhcp

#virtual bridge
auto br0
iface br0 inet dhcp
   bridge_ports eth0
   bridge_stp off
   bridge_fd 0
   bridge_maxwait 0
The ifconfig output of the Linux Mint host
Code:
br0       Link encap:Ethernet  HWaddr a0:1d:48:97:5b:74  
          inet addr:192.168.222.222  Bcast:192.168.222.255  Mask:255.255.255.0
          inet6 addr: fe80::a21d:48ff:fe97:5b74/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1416 errors:0 dropped:0 overruns:0 frame:0
          TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:326680 (326.6 KB)  TX bytes:11025 (11.0 KB)

eth0      Link encap:Ethernet  HWaddr a0:1d:48:97:5b:74  
          inet addr:192.168.222.222  Bcast:192.168.222.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4976 errors:0 dropped:0 overruns:0 frame:0
          TX packets:671 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:604477 (604.4 KB)  TX bytes:92342 (92.3 KB)
          Interrupt:17 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:5992 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5992 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2638916 (2.6 MB)  TX bytes:2638916 (2.6 MB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1334 (1.3 KB)  TX bytes:5282 (5.2 KB)

vnet0     Link encap:Ethernet  HWaddr fe:54:00:45:aa:97  
          inet6 addr: fe80::fc54:ff:fe45:aa97/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:333 errors:0 dropped:0 overruns:0 frame:0
          TX packets:609 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:50908 (50.9 KB)  TX bytes:128537 (128.5 KB)
The only issue I am having is that the Linux Mint host cannot connect to the internet and/or ping local hosts on my LAN anymore. But at least there is some progress
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 11th November 2014 at 04:01 AM. Reason: Continue
Reply With Quote
  #3   (View Single Post)  
Old 11th November 2014
Oko's Avatar
Oko Oko is offline
Fsck Surgeon
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 856
Thanked 36 Times in 32 Posts
Default

Quote:
Originally Posted by J65nko View Post
It all works rather well. The only thing I haven't figured out is how to configure the network part in such a way that I can use an external box login over SSH to for example the FreeBSD 9.3 image.
And that is the only non-trivial part This is how you configure bridge mode on Red Hat.

Code:
[root@/etc/sysconfig/network-scripts]# more ifcfg-eth0
DEVICE=eth0
TYPE="Ethernet"
ONBOOT="yes"
NM_CONTROLLED="no"
BRIDGE=br0
Code:
[root@/etc/sysconfig/network-scripts]# more ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.6.80
NETMASK=255.255.255.0
DELAY=0
Code:
more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oko.mydomain.org
GATEWAY=192.168.6.254
then restart the network
Reply With Quote
  #4   (View Single Post)  
Old 2 Weeks Ago
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,254
Thanked 182 Times in 149 Posts
Default

I printed the virt-install(1) and virsh(1) man pages so I could study them conveniently.
The virt-install(1) man page explains the types of networking:
Code:
Networking Configuration
    -w NETWORK, --network=NETWORK,opt1=val1,opt2=val2
      Connect the guest to the host network. The value for "NETWORK" can take one of 3 formats:

      bridge=BRIDGE
          Connect to a bridge device in the host called "BRIDGE". Use this option if the host has static
          networking config & the guest requires full outbound and inbound connectivity  to/from the LAN.
          Also use this if live migration will be used with this guest.

      network=NAME
          Connect to a virtual network in the host called "NAME". Virtual networks can be listed,
          created, deleted using the "virsh" command line tool. In an unmodified install of "libvirt"
          there is usually a virtual network with a name of "default". Use a virtual network if the host
          has dynamic networking (eg NetworkManager), or using wireless. The guest will be NATed to the
          LAN by whichever connection is active.
So the following option for # virt-install will configure the networking for the guest system:
Code:
--network bridge=br0,model=virtio
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Tags
guest, hypervisor, kvm, kvm bridged networking, kvm networking

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Version 2.2.0 of the Parrot virtual machine arrives J65nko News 1 20th March 2010 04:01 AM
Networking on virtual machine satimis General software and network 4 29th November 2008 02:16 PM
USB support in virtual machine? Sunnz OpenBSD Packages and Ports 2 16th November 2008 04:00 AM
highly secure virtual machine uptonm OpenBSD Security 26 28th July 2008 10:10 PM
Extract ISO under OpenVZ virtual machine stukov Other BSD and UNIX/UNIX-like 1 14th May 2008 09:46 PM


All times are GMT. The time now is 06:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick