0

I'm pretty new in the field of virtualization. I'm using esxi to manage my virtual machines. I have 2 networks, one is the local network with the gateway 192.168.0.1 and the other is the main network of my system. I have three vms that two of them are assigned static ip addresses and they also have access to the local network. The third vm has no static ips, but I want it to access the local network. I have added both networks to all vms in esxi and changed the network script files as below:

vm1- File: ifcfg-ens224 :

TYPE=Ethernet
BOOTPROTO=none
NAME=ens224
DEVICE=ens224
ONBOOT=yes
IPADDR=192.168.0.101
PREFIX=29
GATEWAY=192.168.0.1

Vm2: File: ifcfg-ens224 :

TYPE=Ethernet
BOOTPROTO=none
NAME=ens224
DEVICE=ens224
ONBOOT=yes
IPADDR=192.168.0.102
PREFIX=29
GATEWAY=192.168.0.1

Vm3: File: ifcfg-ens224

TYPE=Ethernet
BOOTPROTO=none
NAME=ens224
DEVICE=ens224
ONBOOT=yes
IPADDR=192.168.0.103
PREFIX=29
GATEWAY=192.168.0.1

I am able to ping 192.168.0.101 from vm2 and ping 192.168.0.102 from vm1. But I can't ping 192.168.0.103 from them. And also I'm able to ping the gateway (192.168.0.1) from vm3, But when I try pinging others (i.e: 192.168.0.101) it results in Destination host unreachable error. I will be grateful for any ideas that mention what I'm doing wrong here or what is missing.

2
  • 192.168.0.101/29 is not in the same subnet as the gateway. Jul 11, 2020 at 13:50
  • @JohanMyréen Can you please explain more?
    – Ana Lava
    Jul 11, 2020 at 13:57

1 Answer 1

2

Your hosts have IP addresses: 192.168.0.103/29, 192.168.0.102/29 and 192.168.0.101/29. This whole /29 subnet contains addresses in the range of 192.168.0.97-192.168.0.102. The IP 192.168.0.103/29 is not a valid IP to give to a host, it is a broadcast IP. Also, the gateway has the IP of 192.168.0.1, so the hosts in that subnet don't know about it, as it resides in a completely different subnet.

To break it down:

Address:   192.168.0.103         11000000.10101000.00000000.01100 111
Netmask:   255.255.255.248 = 29  11111111.11111111.11111111.11111 000
Wildcard:  0.0.0.7               00000000.00000000.00000000.00000 111
=>
Network:   192.168.0.96/29       11000000.10101000.00000000.01100 000 (Class C)
Broadcast: 192.168.0.103         11000000.10101000.00000000.01100 111
HostMin:   192.168.0.97          11000000.10101000.00000000.01100 001
HostMax:   192.168.0.102         11000000.10101000.00000000.01100 110
Hosts/Net: 6                     (Private Internet)

You need to redesign the network addressing so that the IP addresses are valid. You can use a subnetting calculator such as this one.

The easiest solution for you would be changing a prefix from 29 to 24, so that the range is wide and contains all of the IP addresses that you have already set for the machines and the gateway.

1
  • Thanks! I changed the ip to 192.168.0.97 and it worked! :)
    – Ana Lava
    Jul 11, 2020 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.