Score:0

Internet connection problems with ubuntu server VM network

in flag

so i'm pretty new in networks and wanna test some stuff in a virtual machine first.

I've build a small VM network with Ubuntu Servers. You can look at network diagramm by clicking on this link (ignore the switches, they are only for ilustrational purpose). So basically i wanted to connect two networks with a linux server which is configured as a router. The problem is that now the communication between the internal networks is possible and i can ping for example PC1 and PC2 but i have no internet connection thru the NAT to google or other sides for example. Using ping google.com or ping 8.8.8.8 puts out the following messages:

ping: google.com: Temporary failure in name resolution

and

From 192.168.1.1 icmp_seq=1 Destination Host Unreachable

This happens on every device in the VM network. I've already tested a completely new VM also with the same distribution as well as the same NAT settings and it worked without any problems. I could ping google.com normally. So it's impossible that the Virtual Box settings are causing the problems in my network.

I've created the network in the steps below:

  1. I've created every VM with the ubuntu server as the distribution and every VM has a NAT connection with port forwarding for the host access possibility. Also every VM has at least 1 adapter for the internal network. The port forwarding is successful working as expected and i can access every VM with PuTTy on my host PC.

  2. I edited the static ips for every machine so that they see eachother. The ips are shown in the network diagramm above. The netplan settings in /etc/netplan for PC1 are listed here:

network:
  ethernets:
    enp0s3:
      dhcp4: true
    enp0s8:
      dhcp4: no
      addresses: [192.168.1.11/24]
      gateway4: 192.168.1.1
  version: 2

enp0s3 is the NAT adapter and enp0s8 the internal network adapter.

  1. for the router settings i've used 2 ethernet adapters as well as the NAT adapter again. The netplan looks as follow:
network:
  ethernets:
    enp0s3:
      dhcp4: true
    enp0s8:
      dhcp4: no
      addresses:
        - 192.168.1.1/24
      gateway4: 192.168.1.1
    enp0s9:
      dhcp4: no
      addresses:
        - 192.168.2.1/24
      gateway4: 192.168.2.1
  version: 2

and i've enabled the ip4 forwarding in /etc/systctl.conf by uncommenting net.ipv4.ip_forward=1 That's pretty much it. I'm really frustrated because i've no idea why it's not working right now and spent more than 8 hours searching for it. I'd appreciate every help :) I can also provide more information if needed.

`


Hi thank you for your answer! My PC1 route looks like that:

default via 192.168.1.1 dev enp0s8 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.1.0/24 dev enp0s8 proto kernel scope link src 192.168.1.11

I'm not completely sure if it's valid to use two routes for the default source..

The routes of my Router looks like follow:

default via 192.168.1.1 dev enp0s8 proto static
default via 192.168.2.1 dev enp0s9 proto static
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.1.0/24 dev enp0s8 proto kernel scope link src 192.168.1.1
192.168.2.0/24 dev enp0s9 proto kernel scope link src 192.168.2.1
Terrance avatar
id flag
Are you sure you didn't accidentally setup the VM network for host-only and not NAT? host-only means that they will only communicate with themselves. NAT works, but usually gets a different IP address in a different subnet. Then you have to make sure that port forwarding is enabled in your network settings in your VM.
in flag
Hei ye all ethernet adapters are either in NAT or Internal Network mode. I've nothing setup as a host only adapter
Terrance avatar
id flag
One other possibility would be to supply your own DNS servers to the `/etc/systemd/resoved.conf` file and then restart the service of `systemctl restart systemd-resolved.service` and see if that helps.
Score:-2
cn flag

Did you check if you have a default route? I think it's missing.

nabil@LAPTOP:~$ ip route
default via 172.30.80.1 dev eth0 -Default route
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.30.80.0/20 dev eth0 proto kernel scope link src 172.30.85.180

Can you check on the PC1 and on the router as well.

On the router Netplan config, could you please comment out the gateway4 line and do ˋsudo netplan apply` then check if you can ping internet from router. If it works try from the other computer.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.