I was trying to create a Virtual Machine using oracle virtual box, I was able to create the VM with CentOS 7 installed on it but I checked the internet access, I found there were no internet access with it. I tried to ping ‘google.com’ and failed.
I did a google search on this as we all do and found two steps which are very helpful and that’s why I thought of posting it here as well. The methods are very easy to execute, we can fix it in no time. Let me tell that one by one.
Two things can mainly cause this issue.
- Chances are that in /etc/resolv.conf you don’t have any nameservers set like in the below image, in which case you want to do the steps mentioned under the image:
Add google name servers in /etc/resolv.conf file using a text editor, I use vi here:
# vi /etc/resolv.conf
nameserver 22.214.171.124 nameserver 126.96.36.199
Please reboot the server after making the changes, now check if you are able to ping any site or IP.
- If the first method fails, please try the step mentioned below, this can also be a reason.
You must check your ethernet device and do this accordingly, here I have it as ‘enp0s3‘.
Add the following to /etc/sysconfig/network-scripts/ifcfg-enp0s3
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
DNS1=188.8.131.52 DNS2=184.108.40.206 # Note this was set to no ONBOOT=yes
Reboot the server and see if you have internet access now, I just got ping result as below when I did this.
That’s all guys. thank you! 🙂
- Load Average on Linux and Unix-like Systems Explained - May 16, 2020
- How to Install Webmin on CentOS/RHEL 7/6/5 – Linux - May 16, 2020
- List addon domains, parked domains and sub domains via command line – cPanel - May 13, 2020