Virtualbox Centos 9 seems no network

Hi all, I follow this lesson
https://learn.kodekloud.com/user/courses/devops-pre-requisite-course/module/9c8f26c1-90d7-488f-a675-1b77e777c173/lesson/b59f934c-4bca-4b71-960f-65dbeac32a49

to install VirtualBox and centos into my Windows laptop. After normal starting , I try to run command “yum update”, it shows error during downloading metadata for respository ‘baseos’.

cat /etc/resolv.conf
#Gernerated by NetworkManager
search home
nameserver 212.230.135.2
nameserver 212.230.135.1

I tried to ping either “212.230.135.2” or “212.230.135.1”, it shows
ping: connect: Network is unreachable

I tried to ping 8.8.8.8, it also shows:
ping: connect: Network is unreachable

Hi @wuyeelok

Looks like the networking on your VM is not configured properly.

Did you update the Networking settings by changing it to Bridged Adapter?

Hi I have already set it to Bridged Adapter as stated in the tutorial.

But still not network.

For you interest: my laptop was connecting to WIFI

Try pinging 8.8.8.8

This still looks like a network configuration issue, you can’t connect to a DNS server to check the hostname mirrors.centos.org

I tried to ping 8.8.8.8, it also shows:
ping: connect: Network is unreachable

That’s the issue. You need to fix the DNS resolution.

Try adding nameserver 8.8.8.8 in the /etc/resolv.conf

To get it working on my Windows 11 laptop. I had to complete the steps below
nmcli connection up enp0s3
ip a

nmcli connection up enp0s3

works but it seems I need to run this command every time I restart my VM

(after running the command)I need to edit the following file in path

/etc/NetworkManager/system-connections

enp0s3.nmconnection

and set autoconnect=true

After that I can still connect to the internet after restarting the VM