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:
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.
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.
- 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