LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-23-2015, 09:55 PM   #1
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Centos 6.6: incomplete network KVM setup


Hi Guys,

I've got part way into installing a kvm guest on my desktop at home, but can't get the networking going.
(this is for self education at home).
/rant - I did this a while ago, but can't find my notes... grrr /rant

Anyway, here's the tech info

Host
Code:
# ifconfig
br0       Link encap:Ethernet  HWaddr 00:02:A5:42:D0:CC  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40276 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:46280181 (44.1 MiB)  TX bytes:4369184 (4.1 MiB)

eth1      Link encap:Ethernet  HWaddr 00:02:A5:42:D0:CC  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40238 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29521 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:46841705 (44.6 MiB)  TX bytes:4371854 (4.1 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:169 errors:0 dropped:0 overruns:0 frame:0
          TX packets:169 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:10789 (10.5 KiB)  TX bytes:10789 (10.5 KiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:AC:1B:6C  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:48368 (47.2 KiB)

vnet0     Link encap:Ethernet  HWaddr FE:54:00:E3:6A:04  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38 errors:0 dropped:0 overruns:0 frame:0
          TX packets:128 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:2340 (2.2 KiB)  TX bytes:31220 (30.4 KiB)

route -n 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
169.254.0.0     0.0.0.0         255.255.0.0     U     1004   0        0 br0
0.0.0.0         192.168.1.254   0.0.0.0         UG    0      0        0 br0

cat ifcfg-eth1
DEVICE=eth1
HWADDR=00:02:a5:42:d0:cc
ONBOOT=yes
BOOTPROTO=dhcp
BRIDGE="br0"

 cat ifcfg-br0
DEVICE="br0"
TYPE="Bridge"
BOOTPROTO="dhcp"
ONBOOT="yes"
DELAY=0
Guest
Code:
ifconfig
eth0      Link encap:Ethernet  HWaddr 52:54:00:E3:6A:04  
          inet addr:192.168.122.2  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fee3:6a04/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11380 (11.1 KiB)  TX bytes:2270 (2.2 KiB)

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:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0

cat ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:E3:6A:04
TYPE=Ethernet
UUID=0a6abdb7-cb34-4513-b46e-bc8c13ea0eb5
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.122.2
NETMASK=255.255.255.0

HOST brtctl - very oddd
Code:
brctl show
bridge name	bridge id		STP enabled	interfaces
br0		/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
/sys/class/net/br0/bridge: No such file or directory
8000.0002a542d0cc	no		eth1
							vnet0
virbr0		/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
/sys/class/net/virbr0/bridge: No such file or directory
8000.525400ac1b6c	yes		virbr0-nic
SSH from host to guest
Code:
ssh 192.168.122.2

ssh: connect to host 192.168.122.2 port 22: No route to host
Guest to host
Code:
 ssh 192.168.1.100
ssh: connect to host 192.168.1.100 port 22: Network is unreachable
Host IPtables
Code:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -i br0 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Guest
Code:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Thanks for any help

Last edited by chrism01; 05-25-2015 at 05:09 AM. Reason: remove rubish ;)
 
Old 05-25-2015, 03:26 PM   #2
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
you realize your VM is not connected to br0 at all, right?
 
Old 05-26-2015, 01:16 PM   #3
dt64
Member
 
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 218

Rep: Reputation: 38
your setup looks like you want to use bridging but your guest network setup is for NAT'ing.
How does your guest definition look like (network section)?
 
Old 05-26-2015, 05:40 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Original Poster
Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Yeah, it was supposed to be bridging...

What happened was that I got into a bit of a tangle trying to set it up and at one point cut myself off from the internet entirely
So, I reduced all the settings files to (effectively) start over.
I'm planning to actually set the IPs to static as well.

I've posted all the Guest network settings in the original post.
Let me know specifically what you want to see if its not already there.
(It'll have to wait till I get home tonight)
 
Old 05-26-2015, 06:59 PM   #5
dt64
Member
 
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 218

Rep: Reputation: 38
Quote:
Originally Posted by chrism01 View Post
I've posted all the Guest network settings in the original post.
I'm sorry but you didn't. You posted the guest OS network settings but I was after the guest virtual machine network definition.
I guess you aren't using plain KVM but possibly something like libvirtd? In this case you'll have an XML VM definition file, in case of libvirtd somewhere in /etc/libvirt/qemu (not exactly sure, can't look it up at the moment). This includes the network "hardware" definition for the VM.

if you are bridging without DHCP on the network you should give the VM an IP from the host's network range (e.g. 192.168.1.200). The VM will show up on the network as a separate PC, depending on some parameters even with it's own MAC.

You current guest internal network setup uses the IP range of the virbr0, which should be used for NAT'ing, not bridging.
 
Old 05-27-2015, 05:27 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Original Poster
Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
ok; I'll look into that when I get some time. Unfortunately things are a bit busy atm and this is just for my own interest, although it will be useful later.
 
  


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
Network setup KVM guest to use eth0 as is. on CentOS Air-Global Linux - Virtualization and Cloud 7 02-28-2013 06:33 AM
[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
CentOS + KVM network problem phatrik Linux - Networking 4 06-08-2012 12:59 AM
Network issue KVM host centos michaelux Linux - Virtualization and Cloud 3 06-05-2010 11:51 PM

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

All times are GMT -5. The time now is 11:20 AM.

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