LinuxQuestions.org
Visit Jeremy's Blog.
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 09-23-2012, 04:43 PM   #1
dralexpe
LQ Newbie
 
Registered: Jun 2007
Posts: 27

Rep: Reputation: 15
Installed Scientific Linux 6.2 on a VM using KVM - no network access


I am running Centos 5.8 and I wanted to see how KVM and Scientific Linux 6.2 work, so I installed the SL as a VM using KVM.

The installation worked fine, I can boot the vm, but I cannot access anything from within the vm.

I created a virtual network, and at configuration I chose "NAT to eth0", which is the physical network card on the host.

Here's some output from the host:


Code:
[root@new-screamer ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:81:74:C7:26
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:81ff:fe74:c726/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:68271 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45914 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:67832456 (64.6 MiB)  TX bytes:4997745 (4.7 MiB)
          Interrupt:185 Memory:d2200000-d2220000

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:22504 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22504 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:13951197 (13.3 MiB)  TX bytes:13951197 (13.3 MiB)

virbr0    Link encap:Ethernet  HWaddr FE:52:00:7A:C1:75
          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:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:3386 (3.3 KiB)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:C0:00:01
          inet addr:172.16.18.1  Bcast:172.16.18.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:C0:00:08
          inet addr:172.16.68.1  Bcast:172.16.68.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vnet0     Link encap:Ethernet  HWaddr FE:52:00:7A:C1:75
          inet6 addr: fe80::fc52:ff:fe7a:c175/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1349 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 b)  TX bytes:73712 (71.9 KiB)

[root@new-screamer ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.68.0     *               255.255.255.0   U     0      0        0 vmnet8
172.16.18.0     *               255.255.255.0   U     0      0        0 vmnet1
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         192.168.1.254   0.0.0.0         UG    0      0        0 eth0
[root@new-screamer ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.fe52007ac175       yes             vnet0
[root@new-screamer ~]# virsh net-list --all
Name                 State      Autostart
-----------------------------------------
virtual_net          active     yes
[root@new-screamer ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:bootps
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             192.168.122.0/24    state RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     anywhere
ACCEPT     all  --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
[root@new-screamer ~]# ping 68.94.156.1
PING 68.94.156.1 (68.94.156.1) 56(84) bytes of data.
64 bytes from 68.94.156.1: icmp_seq=1 ttl=57 time=31.3 ms
64 bytes from 68.94.156.1: icmp_seq=2 ttl=57 time=26.0 ms
64 bytes from 68.94.156.1: icmp_seq=3 ttl=57 time=27.3 ms
64 bytes from 68.94.156.1: icmp_seq=4 ttl=57 time=27.0 ms

--- 68.94.156.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 26.009/27.951/31.366/2.039 ms


It seems to me that the host is alright, but the vm cannot access anything. Here is a screenshot of the vm trying to ping the DNS used by the host:

I tried to reconfigure the network interface on the vm, using system-config-network. The ifcfg-virbr0 file looks like this:


I used the same default gateway IP 192.168.1.254 of the DSL modem which the host uses.

I am not an expert, but I feel that the virbr0 at 192.168.122.1 on the host is not connected to the virbr0 at 192.168.122.1 on the vm.

Any help will be appreciated.
Thank you

Attached Thumbnails
Click image for larger version

Name:	vm_screenshot1.png
Views:	81
Size:	12.6 KB
ID:	10748   Click image for larger version

Name:	vm_screenshot2.png
Views:	81
Size:	8.8 KB
ID:	10749  
 
Old 09-27-2012, 06:38 PM   #2
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
This might be kind of obvious, but do you have ip forward enable?
 
Old 09-28-2012, 05:56 PM   #3
dralexpe
LQ Newbie
 
Registered: Jun 2007
Posts: 27

Original Poster
Rep: Reputation: 15
Unhappy

Yes, ip_forward is enabled in both the host and the vm.
 
Old 09-28-2012, 06:15 PM   #4
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
Have you tried to disable all iptables rules to test and then start enabling them?
 
Old 09-28-2012, 07:00 PM   #5
dralexpe
LQ Newbie
 
Registered: Jun 2007
Posts: 27

Original Poster
Rep: Reputation: 15
I stopped the iptables on both the host and vm with the command /etc/init.d/iptables stop. That also flushed the firewall rules.

The LAN of the host and DSL modem is 192.168.1.0, the virtual network on which virbr0 resides is 192.168.122.0. I added a route in the vm to the network 192.168.1.0 through the device virbr0, and when I tried to ping the DSL modem (at 192.168.1.254) I get destination host unreachable.
 
Old 09-28-2012, 09:09 PM   #6
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by dralexpe View Post
[FONT=Arial Black][SIZE=2]I am running Centos 5.8 and I wanted to see how KVM and Scientific Linux 6.2 work, so I installed the SL as a VM using KVM.

The installation worked fine, I can boot the vm, but I cannot access anything from within the vm.
Disable network-manager and configure the network manually (for example, in /etc/sysconfig/network-scripts/ifcfg-eth0).

I had to disable SELinux and the firewall as well (I use firewalling on the host instead).
 
  


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
problem of network card with scientific linux wardani Red Hat 10 06-14-2011 11:05 AM
LXer: KVM & Virtio (disk/nic) on Scientific Linux 6 (alpha 3) LXer Syndicated Linux News 0 12-29-2010 03:10 PM
LXer: Set up KVM on Scientific Linux 6 Server (alpha 3) LXer Syndicated Linux News 0 12-23-2010 11:20 PM
[SOLVED] How to configure network(internet) in scientific linux ? biplabbijay Linux - Newbie 7 04-06-2010 09:42 PM
qemu-kvm howto setup virtual network to access Internet garydale Linux - Virtualization and Cloud 5 03-06-2010 12:16 PM

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

All times are GMT -5. The time now is 07:18 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