Facebook
Twitter
LinkedIn
YouTube
GitHub
Hasan's Blog
  • General
  • CI/CD
  • DevOps
  • Test Mgmt & Automation
  • Blog
    • About me

Solved – How to fix Internet connection Issue in Linux CentOS 7 Quickly

2020/03/18Hasan YousufUncategorized

Anyway, lately, I installed CentOS 7 over VMware and installation were quite smooth. Immediate after installation, I tried to browse some web, and it was failing.

While doing basic troubleshooting, I noticed there were no IP when I did ifconfig

[chandan@localhost ~]$ ifconfig
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 
ether 00:0c:29:68:22:e2  txqueuelen 1000  (Ethernet) 
RX packets 0  bytes 0 (0.0 B) 
RX errors 0  dropped 0  overruns 0  frame 0 
TX packets 0  bytes 0 (0.0 B) 
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536 
inet 127.0.0.1  netmask 255.0.0.0 
inet6 ::1  prefixlen 128  scopeid 0x10<host> 
loop  txqueuelen 0  (Local Loopback) 
RX packets 642  bytes 55820 (54.5 KiB) 
RX errors 0  dropped 0  overruns 0  frame 0 
TX packets 642  bytes 55820 (54.5 KiB) 
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[chandan@localhost ~]$

Are you in the same situation like I was?

In this article, I will talk about how to fix if you don’t get the Internet on VMware with CentOS 7.

That leads me to think either network adaptor is not enabled or failed to obtain DHCP IP address.

Quick Solution

  1. Access terminal/console
  2. Become a root if you are not already
  3. Execute “dhclient –v” command
  4. You will notice it will bound IP address as shown below
[root@localhost network-scripts]# dhclient -v
Internet Systems Consortium DHCP Client 4.2.5 Copyright 2004-2013
Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/ens32/00:0c:29:68:22:e2
Sending on   LPF/ens32/00:0c:29:68:22:e2
Sending on   Socket/fallback DHCPDISCOVER on ens32 to 255.255.255.255 port 67 interval 4 (xid=0x433a9e33) DHCPREQUEST on ens32 to 255.255.255.255 port 67 (xid=0x433a9e33)
DHCPOFFER from 172.16.179.254 DHCPACK from 172.16.179.254 (xid=0x433a9e33) bound to 172.16.179.136 -- renewal in 822 seconds.
[root@localhost network-scripts]#

5.     Boom, that’s all, you should have the Internet now. You will also notice IP when you do ifconfig

[root@localhost network-scripts]# ifconfig
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 
inet 172.16.179.136  netmask 255.255.255.0  broadcast 172.16.179.255 
ether 00:0c:29:68:22:e2  txqueuelen 1000  (Ethernet) 
RX packets 11  bytes 1255 (1.2 KiB) 
RX errors 0  dropped 0  overruns 0  frame 0 
TX packets 23  bytes 3536 (3.4 KiB) 
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536 
inet 127.0.0.1  netmask 255.0.0.0 
inet6 ::1  prefixlen 128  scopeid 0x10<host> 
loop  txqueuelen 0  (Local Loopback) 
RX packets 770  bytes 66956 (65.3 KiB) 
RX errors 0  dropped 0  overruns 0  frame 0 
TX packets 770  bytes 66956 (65.3 KiB) 
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Add this in auto-startup

You might be interested in putting this in auto-startup, so you don’t have to do this every time you start the CentOS VM.

This is how you can put the script in auto-startup, so it starts automatically after VM is rebooted.

  • Go to /etc/init.d
  • Create a file with following, I have kept the name as “net-autostart“
#!/bin/bash
# Solution for "No Internet Connection from VMware"
#
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
dhclient -v
  • Save the file
  • Change the file permission as executable
chmod 755 net-autostart
  • Add this script for auto-start using chkconfig command
chkconfig --add net-autostart
  • Restart VM to test

I hope this helps. Let me know how it goes with you.

Related Posts:

  • How to setup network after RHEL/CentOS 7 minimal…
  • Trying to upload Blink example (Arduino sketch) on…
  • How to install Sonatype Nexus 3 on Centos6.10
  • dial unix /var/run/docker.sock: permission denied
  • Install Node.js on Ubuntu 16.04
  • How To Install Java with Apt-Get on Ubuntu 16.10

Share this:

  • Twitter
  • Facebook

Related

Previous post How to setup network after RHEL/CentOS 7 minimal installation Next post How to navigate long commands faster

Hasan Naqvi

Categories

  • Casperjs (1)
  • CI/CD (4)
  • DevOps (6)
  • Gruntjs (2)
  • Jira (1)
  • Linux (1)
  • Programming (1)
  • Uncategorized (14)
  • VMware (1)

Archives

  • May 2020 (1)
  • April 2020 (1)
  • March 2020 (2)
  • September 2019 (2)
  • May 2018 (1)
  • September 2017 (3)
  • July 2017 (1)
  • June 2017 (4)
  • May 2017 (1)
  • July 2015 (2)
  • January 2015 (1)
  • October 2014 (1)
  • September 2014 (5)
  • August 2014 (1)

Tags

Arduino Arduino sketch Arduino sketch upload bash shell casperjs Couchdb Curl docker container docker images github Gitlab gnu Parallel gruntjs JAVA JAVA jenkins Jira JPA Json Linux linux mint Maven mint MYSQL Tomcat Ubuntu Version Control xpath

Top Posts & Pages

  • CURD functions and REST api
  • How to completely uninstall Android Studio on MAC?
  • Before you can run vmware several modules must be compiled and loaded into the running kernel
  • Trying to upload Blink example (Arduino sketch) on my Arduino uno
  • fill form using xpath in casperjs
  • Delete docker images & containers in one command
  • How to import data in couchdb using JSON file

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

  • General
  • CI/CD
  • DevOps
  • Test Mgmt & Automation
  • Blog
    • About me
@2017