Friday, January 23, 2026

How to fix internet issues on virtualbox guest VMs with NAT

 How to fix internet issues on virtualbox guest VMs with NAT


1) Identify the issue


(base) [root@localhost ~]# ping www.google.com

^C

(base) [root@localhost ~]#


2) Quick fix is to edit /etc/resolv.conf as shown below..


Actual:


(base) [root@localhost ~]# cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 10.0.2.3

(base) [root@localhost ~]#


Replace it as shown below:


(base) [root@localhost ~]# cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 8.8.8.8

nameserver 1.1.1.1

(base) [root@localhost ~]#


3) Test the fix 


(base) [root@localhost ~]# ping google.com

PING google.com (192.178.223.113) 56(84) bytes of data.

64 bytes from yulhrs-in-f113.1e100.net (192.178.223.113): icmp_seq=1 ttl=105 time=7.23 ms

^C

--- google.com ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 7.227/7.227/7.227/0.000 ms

(base) [root@localhost ~]#


4) Make it persistent across restarts


(base) [root@localhost ~]# nmcli conn show

NAME             UUID                                  TYPE      DEVICE

eth0             a313d9c0-8613-468f-a354-e892fe7e3817  ethernet  eth0

System eth1      9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04  ethernet  eth1

lo               a12a3dcb-af7a-4987-b824-7a9fb48c3b0b  loopback  lo

br-7ca1385b85f2  b51a597f-e9c5-43f1-95bf-68f5ed335192  bridge    br-7ca1385b85f2

docker0          21fd4af2-d44f-4931-9b1a-985fa92769eb  bridge    docker0

(base) [root@localhost ~]#


5) Look for the connection supplying dns


(base) [root@localhost ~]# nmcli dev show | grep DNS

IP4.DNS[1]:                             10.0.2.3

(base) [root@localhost ~]#


6) Examine the below network manager conf file


cat /etc/NetworkManager/system-connections/eth0.nmconnection

[connection]

id=eth0

uuid=a313d9c0-8613-468f-a354-e892fe7e3817

type=ethernet

autoconnect-priority=-100

autoconnect-retries=1

interface-name=eth0

multi-connect=1

timestamp=1756384622

wait-device-timeout=60000


[ethernet]


[ipv4]

method=auto


[ipv6]

addr-gen-mode=eui64

method=auto


[proxy]


[user]

org.freedesktop.NetworkManager.origin=nm-initrd-generator

(base) [root@localhost ~]#


7) Look for dns related setting


grep -i dns /etc/NetworkManager/system-connections/eth0.nmconnection


8) Add the nameservers now which we added above


nmcli con mod "eth0" ipv4.dns "8.8.8.8,1.1.1.1"

nmcli con mod "eth0" ipv4.ignore-auto-dns yes

nmcli con up "eth0"


Actual:

(base) [root@localhost ~]# grep -i dns /etc/NetworkManager/system-connections/eth0.nmconnection

(base) [root@localhost ~]# nmcli con mod "eth0" ipv4.dns "8.8.8.8,1.1.1.1"

(base) [root@localhost ~]# nmcli con mod "eth0" ipv4.ignore-auto-dns yes

(base) [root@localhost ~]# nmcli con up "eth0"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

(base) [root@localhost ~]#


9) Check if ip is up


(base) [root@localhost ~]# ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000

    link/ether 08:00:27:dc:3b:82 brd ff:ff:ff:ff:ff:ff

    altname enp0s3

    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute eth0

       valid_lft 86398sec preferred_lft 86398sec

    inet6 fe80::a00:27ff:fedc:3b82/64 scope link noprefixroute

       valid_lft forever preferred_lft forever



10) Verify the file /etc/NetworkManager/system-connections/eth0.nmconnection


(base) [root@localhost ~]# cat /etc/NetworkManager/system-connections/eth0.nmconnection

[connection]

id=eth0

uuid=a313d9c0-8613-468f-a354-e892fe7e3817

type=ethernet

autoconnect-priority=-100

autoconnect-retries=1

interface-name=eth0

multi-connect=1

timestamp=1769037930

wait-device-timeout=60000


[ethernet]


[ipv4]

dns=8.8.8.8;1.1.1.1;

ignore-auto-dns=true

method=auto


[ipv6]

addr-gen-mode=eui64

method=auto


[proxy]


[user]

org.freedesktop.NetworkManager.origin=nm-initrd-generator

(base) [root@localhost ~]#


11) Verify further setup and test internet


(base) [root@localhost ~]# nmcli dev show | grep DNS

IP4.DNS[1]:                             8.8.8.8

IP4.DNS[2]:                             1.1.1.1

(base) [root@localhost ~]# cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 8.8.8.8

nameserver 1.1.1.1

(base) [root@localhost ~]#


12) check internet


(base) [root@localhost ~]# ping google.com

PING google.com (192.178.223.113) 56(84) bytes of data.

64 bytes from yulhrs-in-f113.1e100.net (192.178.223.113): icmp_seq=1 ttl=105 time=7.24 ms

^C

--- google.com ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 7.244/7.244/7.244/0.000 ms

(base) [root@localhost ~]#


No comments:

Post a Comment

Ingest csv data into Apache Iceberg using spark notebook

  Objective: Ingest csv data into Apache Iceberg using spark notebook Steps: 1. Start our VM 2. start our docker containers cd /opt/de [root...