Failure When Pinging Default Gateway on Linux Mint 22.3 Virtual Machine

I’m on Linux Mint 22.3 and having trouble understanding why a simple gateway ping doesn’t seem to function.

For the Linux course I’m taking at my community college, we’ve been assigned to write a system report script. I’ve went and added a conditional to the script that checks for a successful gateway ping to verify that it is reachable.

ping -c 1 10.0.2.0 
if [ $? == 0 ]
then
        echo "Gateway Ping Successful"
else
        echo "Gateway Ping Failed"
fi

This always turns up a failure.

 - Loopback Ping Test -

PING 10.0.2.0 (10.0.2.0) 56(84) bytes of data.
From 10.0.2.15 icmp_seq=1 Destination Host Unreachable

--- 10.0.2.0 ping statistics ---
1 packets transmitted, received, +1 errors, 100% packet loss, time Oms

Gateway Ping Failed

This is the correct gateway displayed in the output of route, and I know routing is operational since Firefox and other network services on my VM can reach the internet.

Destination    Gateway      Genmask        Flags  Metric  Ref  Use  Iface
default        _gateway     0.0.0.0        UG     100     0    0    enp0s3
10.0.2.0       0.0.0.0      255.255.255.0  U      100     0    0    enp0s3

Another strange thing I noticed was the traceroute command returning a different default gateway than the route command.

$ traceroute google.com 
traceroute to google.com (142.251.210.110), 30 hops max, 60 byte packets 
1   _gateway (10.0.2.2)  8.023 ms  7.538 ms  7.234 ms
2   * * *
3   * * *

Can someone assist with my understanding on how VM routing and network connectivity works? I do apologize if this qualifies as a low effort post. I feel a bit dumb just asking this, and I’m sure the answer is right under my nose.