LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   KVM guest unable to ping and access internet from the Physical host machine (https://www.linuxquestions.org/questions/linux-newbie-8/kvm-guest-unable-to-ping-and-access-internet-from-the-physical-host-machine-4175463532/)

manuce 05-26-2013 06:26 PM

KVM guest unable to ping and access internet from the Physical host machine
 
Hello,

I just installed a Centos VM over a physical machine. here is my scenario.

Host machine name : Physical.example.com (CENTOS 6.3) 192.168.2.200 255.255.255.0 dns:192.168.2.200 ( iptable / selinux all off)

Guest machine name setup through KVM: server.example.com (CENTOS6.3)

When I was setting this guest vm over KVM I chose DHCP and everything worked fine ,I was able to ping Physical.example.com and was able to access the wifi lan on it

Until

I changed the IP to 192.168.2.201 on server.example.com
everthing is mess I am unable to ping the physical.example.com and unable to access the internet.

I have very very minimal knowledge of NATing and bridge so please explain me a little more or refer me to some docs or tutorial so that I know how to set the VM properly.


Ifconfig from Physical.example.com :


eth0 Link encap:Ethernet HWaddr 00:19:21:0A:52:89
inet addr:192.168.2.200 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:16

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

virbr0 Link encap:Ethernet HWaddr 52:54:00:D8:EA:F8
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:53 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4419 (4.3 KiB) TX bytes:3302 (3.2 KiB)

virbr1 Link encap:Ethernet HWaddr 52:54:00:6D:C6:D5
inet addr:192.168.3.1 Bcast:192.168.3.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:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:3290 (3.2 KiB)

vnet0 Link encap:Ethernet HWaddr FE:54:00:41:5B:F9
inet6 addr: fe80::fc54:ff:fe41:5bf9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55 errors:0 dropped:0 overruns:0 frame:0
TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:5341 (5.2 KiB) TX bytes:5678 (5.5 KiB)

wlan0 Link encap:Ethernet HWaddr 00:1B:2F:D2:BB:13
inet addr:192.168.1.12 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21b:2fff:fed2:bb13/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame:0
TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34906 (34.0 KiB) TX bytes:10317 (10.0 KiB

Setting on the Guest VM Server.example.com (centos 6.3)

Virtual network interface :
Source device : Virtual network 'default':NAT
Device Model : Hypervisor default
MAC address :52:54:00:5e:c1:81

It work fine on this default setting as it acquire the ip from DHCP and get the ip from vbr0 of physical.example.com which is 192.168.122.X

but as soon as I change it to static ip of 192.168.2.201 it (server.example.com) is unable to ping the physical.example.com(192.168.2.200) and unable to access the internet.

Will be thankful for the help. Cheers-M

acid_kewpie 05-28-2013 02:48 AM

so you changed the IP from one that matched the connected internal bridge, to one that didn't at all, broke the basic concepts of TCP/IP routing and it didn't work? Funny that! :)

You'd reach the internet conventionally by using NAT networking, which the 122 subnet usually is, which will make all traffic from the VM appear to come from the box as a whole. If you want the VM to be on the same network range as the host, then you'd need to add a new bridge interface and add both the physical eth0 aand the VM virtual interface on to that. Last time I did this osrt of thing though, it was impossible to automatically configure through virt-manager, unlike conventional bridge nat networking.


All times are GMT -5. The time now is 10:31 AM.