LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-19-2012, 06:25 PM   #1
Neven1986
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Rep: Reputation: Disabled
KVM guest cannot access internet


Hello I'm newly registered to forum, but I read forum alot. It's been great source of articles and knowledge for me, as for many other peoples.

I have problem with networking and VM guest (KVM) in CentOS 6.

I have server with one NIC and IP address 81.XXX.10.115, also i configured VM guest (IP of guest 81.XXX.11.141) to communicate through bridge (IP of bridge 81.XXX.11.140). As you can see host NIC IP is I one public subnet and bridge + VM guest are in second public subnet. Both subnets are /24.

VM guest can ping bridge IP.
VM guest can ping host IP and vice versa.

But VM guest cannot ping outside (to the interent) and vice versa.

I don't know how to solve this. On host ip tables firewall is DISABLED.

Sysctl.conf contains:

Code:
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
Host route table shows.

Code:
81.XXX.10.0/24 dev eth0  proto kernel  scope link  src 81.XXX.10.115
81.XXX.11.0/24 dev bridge0  proto kernel  scope link  src 81.XXX.11.140
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1
169.254.0.0/16 dev eth0  scope link  metric 1002
default via 81.XXX.10.1 dev eth0
I'm pretty sure that problem lies somewhere in host configuration, but I'm clueless. So any help would be appriciated.

Thank you in advance.

Neven
 
Old 10-24-2012, 06:21 PM   #2
zoltan1
LQ Newbie
 
Registered: Oct 2012
Posts: 9

Rep: Reputation: Disabled
If you want to use the same physical NIC for both subnets then you need to first setup a bridge (let's call it br0) on the host machine and add your eth0 device to that bridge. Instead of assigning your host's IP address to your eth0 adapter, assign that IP address to your br0 adapter! Basically, you need to take your current network settings (for your 1st subnet) from /etc/sysconfig/network-scripts/ifcfg-eth0 file and place them into /etc/sysconfig/network-scripts/ifcfg-br0

Here is how such an ifcfg-br0 file looks like:

DEVICE="br0"
TYPE="Bridge"
ONBOOT="yes"
BOOTPROTO=static
IPADDR=81.XXX.10.115
NETMASK=255.255.255.0
NETWORK=81.XXX.10.0
GATEWAY=XXX.XXX.XXX.XXX
DELAY=0
STP=off
DNS1="YYY.YYY.YYY.YYY"
PEERDNS="yes"
NM_CONTROLLED=no

You also need to change your /etc/sysconfig/network-scripts/ifcfg-eth0 file on your host machine to look something like this:

DEVICE="eth0"
TYPE="Ethernet"
HWADDR=XX:XX:XX:XX:XX:XX <- your physical NIC's MAC address goes here
ONBOOT="yes"
BRIDGE="br0"
NM_CONTROLLED="no"

Double check that everything is right and restart networking:

/etc/init.d/network restart

Inside your VM you just configure the network on the VM's eth0 adapter (for your 2nd subnet) as you would do it on a phycical machine. It should just work.

Note: You DO need these in the host's sysctl.conf :

net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0



*Addition: If you are still having network access problems, try to disable SELinux and the iptables firewall on your host.

Last edited by zoltan1; 10-25-2012 at 07:27 PM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Internet access for KVM VM rkski Linux - Virtualization and Cloud 3 10-10-2012 12:52 AM
KVM guest cannot access host thehemi Linux - Virtualization and Cloud 8 03-28-2012 04:36 AM
LXer: Set up Spicevmc Channel on Ubuntu 11.04 as KVM Server and spice-vdagent as a KVM guest LXer Syndicated Linux News 0 06-15-2011 07:10 PM
KVM with Ubuntu guest - guest crashes when some apps are 'full screened' TonyRogers Linux - Virtualization and Cloud 0 05-15-2011 12:18 PM
KVM: Mouse under Windows Guest performs way better than under Centos Guest martdj Linux - Virtualization and Cloud 3 03-29-2010 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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