ubuntu VM Network

Asked 2 years ago, Updated 2 years ago, 50 views

I installed and used xubuntu as a VM We set the network settings to NAT and the virtual Box host-only adapter.

But when I first turned it on, the internet wasn't working and I turned it off several times You can turn off and on the network settings in the end.

Router crash?I don't know if it's a problem. Please let me know if you knowcrying It's so stressful to turn it off and on every time.

(If you use NAT only and turn off the host-only adapter, the Internet works well.)

▲ When this doesn't work, it's a route capture screen

▲ This is the route capture screen when you connect to the Internet

network linux

2022-09-21 20:06

1 Answers

Rather than a virtual machine-side problem, it is a problem with Linux's routing settings.

Internet access is not possible because virtual Box host-only adapter has a high priority for which gateway to use when sending packets to the external network.

If you look at the picture, there is Metric, and the smaller the value, the higher the priority.

default  192.168.137.1 ... 100 ...
default  10.0.2.2      ... 101 ...

Since the Internet is connected via 10.0.2.2, lowering the metric value for it will resolve it.

route add -net default gw 10.0.2.2 netmask 0.0.0.0 dev enp0s3 metric 90


2022-09-21 20:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.