0

Host : cent os 7

ip : 192.168.1.3/24 default route : 192.168.1.1

virtual interface ip : virbro : 192.168.4.0/24 gateway : 192.168.4.2

ip a on host

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether c0:3f:d5:66:c3:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 brd 192.168.1.255 scope global dynamic eno1
       valid_lft 62703sec preferred_lft 62703sec
    inet6 fe80::c23f:d5ff:fe66:c301/64 scope link 
       valid_lft forever preferred_lft forever
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether ac:fd:ce:03:2c:58 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic wlp2s0
       valid_lft 62549sec preferred_lft 62549sec
    inet6 fe80::aefd:ceff:fe03:2c58/64 scope link 
       valid_lft forever preferred_lft forever
4: ham0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1404 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether 7a:79:19:5c:7b:fd brd ff:ff:ff:ff:ff:ff
    inet 25.92.123.253/8 brd 25.255.255.255 scope global ham0
       valid_lft forever preferred_lft forever
    inet6 2620:9b::195c:7bfd/96 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::7879:19ff:fe5c:7bfd/64 scope link 
       valid_lft forever preferred_lft forever
5: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 52:54:00:35:f6:c9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.4.0/24 brd 192.168.4.255 scope global virbr0
       valid_lft forever preferred_lft forever
    inet 192.168.4.3/24 scope global secondary virbr0
       valid_lft forever preferred_lft forever
6: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
    link/ether 52:54:00:35:f6:c9 brd ff:ff:ff:ff:ff:ff

ip r on host

[root@centos services]# ip r
default via 192.168.1.1 dev eno1  proto static  metric 100 
default via 192.168.1.1 dev wlp2s0  proto static  metric 600 
25.0.0.0/8 dev ham0  proto kernel  scope link  src 25.92.123.253 
192.168.1.0/24 dev eno1  proto kernel  scope link  src 192.168.1.3  metric 100 
192.168.1.0/24 dev wlp2s0  proto kernel  scope link  src 192.168.1.2  metric 600 
192.168.4.0/24 dev virbr0  proto kernel  scope link  src 192.168.4.0 

similarly for guest : cent os 7

ip : 192.168.4.200/24 default route : 192.168.4.2

ip a and ip r on guest enter image description here

I cannot ping the host(192.168.1.3) from the vm(192.168.4.200) also, gives me destination host unreachable.

EDIT : just installed windows in as vm guest and able to ping the guest from it.

windows guest :

 Link-local IPv6 Address . . . . . : fe80::7085:b96
 IPv4 Address. . . . . . . . . . . : 192.168.4.104
 Subnet Mask . . . . . . . . . . . : 255.255.255.0
 Default Gateway . . . . . . . . . : 192.168.4.0

:\Users\IEUser>ping 192.168.1.3

inging 192.168.1.3 with 32 bytes of data:
eply from 192.168.1.3: bytes=32 time<1ms TTL=64
eply from 192.168.1.3: bytes=32 time<1ms TTL=64
eply from 192.168.1.3: bytes=32 time<1ms TTL=64
eply from 192.168.1.3: bytes=32 time<1ms TTL=64

ing statistics for 192.168.1.3:
   Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

host :

munish
  • 1,013

1 Answers1

0

You have to add ip to the virtual nic of the host machine.

ip a a 192.168.4.3/24 dev virbr0

and than access the host machine from the guest on that ip (192.168.4.3)

To fix both problems at once, make sure you have enabled NAT on your VM hypervisor. I would expect the default gateway of the guest OS to be 192.168.4.1. Try to change it with

ip r d default via 192.168.4.2
ip r a default via 192.168.4.1

If this does not work, send results of following commands for both systems:

ip a
ip r
  • just installed windows as vm and able to access the host from it.not sure why linux guest are not allowing this – munish Oct 24 '16 at 10:51