LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-13-2021, 01:23 AM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post Why VM2 can't ping one machine?


Hello,
I created three VMs in the VirtualBox as below:
Code:
VM1 (node1) : Two NICs (Internal Network, NAT)
VM2 (node2) : Two NICs (Internal Network, NAT)
VM3 (node3) : One NIC  (Internal Network)
VM1 can see VM2 and VM3, but VM2 just see VM1. In other words, VM2 and VM3 can't see each other!

On VM1:
Code:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
And:
Code:
# ping node2
PING node2 (192.168.1.10) 56(84) bytes of data.
64 bytes from node2 (192.168.1.10): icmp_seq=1 ttl=64 time=0.462 ms
64 bytes from node2 (192.168.1.10): icmp_seq=2 ttl=64 time=0.619 ms
64 bytes from node2 (192.168.1.10): icmp_seq=3 ttl=64 time=0.659 ms
^C
--- node2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.462/0.580/0.659/0.085 ms
And:
Code:
# ping node3
PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data.
64 bytes from 192.168.1.4: icmp_seq=1 ttl=64 time=0.469 ms
64 bytes from 192.168.1.4: icmp_seq=2 ttl=64 time=0.654 ms
64 bytes from 192.168.1.4: icmp_seq=3 ttl=64 time=0.624 ms
^C
--- 192.168.1.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2032ms
rtt min/avg/max/mdev = 0.469/0.582/0.654/0.081 ms
On VM2:
Code:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.3.2        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
And:
Code:
# ping node1
PING node1 (192.168.1.3) 56(84) bytes of data.
64 bytes from node1 (192.168.1.3): icmp_seq=1 ttl=64 time=0.233 ms
64 bytes from node1 (192.168.1.3): icmp_seq=2 ttl=64 time=0.473 ms
64 bytes from node1 (192.168.1.3): icmp_seq=3 ttl=64 time=0.586 ms
^C
--- node1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
rtt min/avg/max/mdev = 0.233/0.430/0.586/0.147 ms
And:
Code:
# ping node3
PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data.
Why? Is the route table wrong on VM2?

Thank you.

Last edited by n00b_noob; 03-13-2021 at 01:38 AM.
 
Old 03-13-2021, 07:51 AM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You say, VM1 can ping VM2, but can VM1 ping BOTH IPs of VM2?
What is the output of "ip a" on all of your VMs?
 
Old 03-13-2021, 12:01 PM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dc.901 View Post
You say, VM1 can ping VM2, but can VM1 ping BOTH IPs of VM2?
What is the output of "ip a" on all of your VMs?
Thank you.
On both VMs (VM1 and VM2), the NAT interface has a same IP address!!!

On VM1:
Code:
[root@node1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:f5:e1:55 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 brd 192.168.1.255 scope global noprefixroute enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fef5:e155/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:35:92:d2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.15/24 brd 10.0.3.255 scope global dynamic noprefixroute enp0s8
       valid_lft 86165sec preferred_lft 86165sec
    inet6 fe80::948f:e722:5c57:7746/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
On VM2:
Code:
[root@node2 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:05:d9:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global noprefixroute enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe05:d969/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:80:56:8d brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.15/24 brd 10.0.3.255 scope global dynamic noprefixroute enp0s8
       valid_lft 86243sec preferred_lft 86243sec
    inet6 fe80::128e:b5d1:fdc5:e0bc/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
On VM3:
Code:
[root@node3 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:c3:b2:6f brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/32 scope global noprefixroute enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fec3:b26f/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
What is the problem?
 
Old 03-13-2021, 03:54 PM   #4
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
So, your VM1 is IP: 192.168.1.3
VM2 is IP: 192.168.1.10

You can ping VM1 from VM2 but not other way around.
In your example, I see you have used the hostnames...
What if you ping with IPs instead? From VM2: ping 192.168.1.3

Also check
tracert -n 192.168.1.3
 
Old 03-13-2021, 11:49 PM   #5
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dc.901 View Post
So, your VM1 is IP: 192.168.1.3
VM2 is IP: 192.168.1.10

You can ping VM1 from VM2 but not other way around.
In your example, I see you have used the hostnames...
What if you ping with IPs instead? From VM2: ping 192.168.1.3

Also check
tracert -n 192.168.1.3
Thanks.
My problem is that VM2 can't see VM3.
VM1 and VM2 can see each other with name and IP.
VM3 IP address is 192.168.1.4.

About the traceroute command:

From VM1 to VM2:
Code:
[root@node1 ~]# traceroute -n 192.168.1.10
traceroute to 192.168.1.10 (192.168.1.10), 30 hops max, 60 byte packets
 1  192.168.1.10  3.477 ms !X  3.500 ms !X  2.508 ms !X
From VM1 to VM3:
Code:
[root@node1 ~]# traceroute -n 192.168.1.4
traceroute to 192.168.1.4 (192.168.1.4), 30 hops max, 60 byte packets
 1  192.168.1.4  1.682 ms !X  0.519 ms !X  0.326 ms !X
From VM2 to VM3:
Code:
[root@node2 ~]# traceroute -n 192.168.1.4
traceroute to 192.168.1.4 (192.168.1.4), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
Maybe I need to configure the network from the beginning. My VMs using Fedora Server. What is the value of the IP in below commands for VM1 to VM3?
Code:
$ sudo nmcli connection modify "UUID" IPv4.address "IP/24"
$ sudo nmcli connection modify "UUID" IPv4.gateway "IP"
$ sudo nmcli connection modify "UUID" IPv4.dns "IP"
$ sudo nmcli connection modify "UUID" IPv4.method manual

Last edited by n00b_noob; 03-13-2021 at 11:58 PM.
 
Old 03-15-2021, 08:59 AM   #6
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I see... on VM3, can you ping the gateway? If not, double check your network settings...
 
Old 03-15-2021, 04:16 PM   #7
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dc.901 View Post
I see... on VM3, can you ping the gateway? If not, double check your network settings...
When I use Internal Network in the VirtualBox, then no need for a gateway! I never defined any gateway. If I must define a gateway and my IP address range is 192.168.1.X, then what is my gateway address? Is 192.168.1.1 my gateway address?

VM1: 192.168.1.3
VM2: 192.168.1.10
VM3: 192.168.1.4

When I disable the second NIC (NAT) of VM2, then everything work. Why?

Last edited by n00b_noob; 03-15-2021 at 04:30 PM.
 
Old 03-17-2021, 03:01 AM   #8
Gad
Member
 
Registered: May 2013
Distribution: FreeBSD
Posts: 566

Rep: Reputation: 114Reputation: 114
Not sure if they related but it looks like VM1 and VM 2 have a duplicate NAT address.

Also when you run a ping use the source command to make sure it attempting the ping from the correct source address
 
Old 03-19-2021, 03:19 AM   #9
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Thanks.
I want to reconfigure my VMs and I just want to test it with two VMs:
Quote:
VM1: 192.168.100.1
VM2: 192.168.100.2
I did below commands on all VMs:
Code:
$ sudo nmcli connection modify "UUID" IPv4.address 192.168.100.X
$ sudo nmcli connection modify "UUID" IPv4.method manual
$ sudo nmcli connection down "UUID"
$ sudo nmcli connection up "UUID"
Then opened /etc/hosts file on all VMs and put the IP addresses and host names of each VMs inside it:
Code:
192.168.100.1 node1.localhost.localdomain node1
192.168.100.2 node2.localhost.localdomain node2
Then:
Code:
# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.1  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::a00:27ff:fef5:e155  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:f5:e1:55  txqueuelen 1000  (Ethernet)
        RX packets 22  bytes 3360 (3.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 4232 (4.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.3.15  netmask 255.255.255.0  broadcast 10.0.3.255
        inet6 fe80::a00:27ff:fe35:92d2  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:35:92:d2  txqueuelen 1000  (Ethernet)
        RX packets 1689  bytes 558532 (545.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1426  bytes 141975 (138.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 21  bytes 2435 (2.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21  bytes 2435 (2.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
And:
Code:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.3.2        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
But VMs can see each other? I never defined any “Gateway” and “DNS”. As I said, in the VirtualBox, I selected “Internal Network” in the “Network” section for each virtual machine. Need I any DNS or Gateway address?
 
Old 03-19-2021, 07:52 AM   #10
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by n00b_noob View Post
Thanks.
I want to reconfigure my VMs and I just want to test it with two VMs:

I did below commands on all VMs:
Code:
$ sudo nmcli connection modify "UUID" IPv4.address 192.168.100.X
$ sudo nmcli connection modify "UUID" IPv4.method manual
$ sudo nmcli connection down "UUID"
$ sudo nmcli connection up "UUID"
Then opened /etc/hosts file on all VMs and put the IP addresses and host names of each VMs inside it:
Code:
192.168.100.1 node1.localhost.localdomain node1
192.168.100.2 node2.localhost.localdomain node2
Then:
Code:
# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.1  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::a00:27ff:fef5:e155  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:f5:e1:55  txqueuelen 1000  (Ethernet)
        RX packets 22  bytes 3360 (3.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 4232 (4.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.3.15  netmask 255.255.255.0  broadcast 10.0.3.255
        inet6 fe80::a00:27ff:fe35:92d2  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:35:92:d2  txqueuelen 1000  (Ethernet)
        RX packets 1689  bytes 558532 (545.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1426  bytes 141975 (138.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 21  bytes 2435 (2.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21  bytes 2435 (2.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
And:
Code:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.3.2        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
But VMs can see each other? I never defined any “Gateway” and “DNS”. As I said, in the VirtualBox, I selected “Internal Network” in the “Network” section for each virtual machine. Need I any DNS or Gateway address?
You have 2 Interfaces above, enp0s3 and enp0s8. Which is Internal network and which is NAT?
In your route table it only has entries for enp0s8. So if you want to communicate over enp0s3 you need to add a route.

Perhaps this may help: https://www.thegeekstuff.com/2012/05/route-flags/
 
Old 03-21-2021, 05:11 AM   #11
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dc.901 View Post
You have 2 Interfaces above, enp0s3 and enp0s8. Which is Internal network and which is NAT?
In your route table it only has entries for enp0s8. So if you want to communicate over enp0s3 you need to add a route.

Perhaps this may help: https://www.thegeekstuff.com/2012/05/route-flags/
The enp0s3 interface is internal network and enp0s8 is NAT. Can you tell me how can I write a route? The syntax "route add <destination> <gateway> <metric>" need a gateway, but I never defined a gateway!
Why "broadcast 0.0.0.0" ?
 
Old 03-21-2021, 08:09 AM   #12
Gad
Member
 
Registered: May 2013
Distribution: FreeBSD
Posts: 566

Rep: Reputation: 114Reputation: 114
Code:
man route
https://www.man7.org/linux/man-pages/man8/route.8.html
 
Old 03-21-2021, 10:55 AM   #13
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by n00b_noob View Post
Can you tell me how can I write a route?
So, here is from your original post:

Quote:
Originally Posted by n00b_noob View Post
On VM1:
Code:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
On VM2:
Code:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.3.2        0.0.0.0         UG    101    0        0 enp0s8
10.0.3.0        0.0.0.0         255.255.255.0   U     101    0        0 enp0s8
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
As you see there are routes defined for both interfaces, and you mentioned in one your other posts, VM1 and VM2 can ping each other.

You need to follow same procedure on creating route tables on each node.

From node1 if you run "traceroute -n node2" you will see which "path" it goes thru.

Hope this helps?
 
  


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
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
I have installed 3 nic, but only one can "ping" other machine, why? mycmos Linux - Networking 10 11-02-2004 06:46 AM
I have installed 3 nic, but only one can "ping" other machine, why? mycmos Linux - Hardware 3 11-01-2004 07:54 AM
I have installed 3 nic, but only one can "ping" other machine, why? mycmos Linux - Enterprise 5 11-01-2004 12:51 AM

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

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