2

I am trying to work with centOS 7 which I installed on VMware workstation.

But it doesn't have internet connection:

$ ping 8.8.8.8
connect: Network is unreachable

$ ping www.google.com
ping: www.google.com: Name or service not known

I checked NAT in my virtual machine settings and it is the output of ifconfig command:

ens33: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:29:7a:53:87  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 1000  (Local Loopback)
        RX packets 504  bytes 44064 (43.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 504  bytes 44064 (43.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:14:b1:67  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

any idea how can I get internet access?

bertieb
  • 7,344
  • 36
  • 42
  • 54
afsane
  • 21
  • 1
  • 1
  • 3

2 Answers2

8

You do not have IP address assigned to your network interface "ens33".

Type "dhclient" in terminal, that should fix the issue, if it does not work, please print output of command "ip addr" from terminal

Regards, Nik

Nik
  • 81
  • 1
  • To make network interface use DHCP permanently edit file: /etc/sysconfig/network-scripts/ifcfg-ens33 with your favorite linux text editor (nano, vi). Inside file look for parameters: - BOOTPROTO and set it to dhcp (example: BOOTPROTO="dhcp") - ONBOOT and set it to yes (example: ONBOOT="yes") – Nik Oct 01 '18 at 07:30
  • Thanks @Nik, "dhclient" does not work. here is the out put of "ip addr": – afsane Oct 01 '18 at 07:40
  • [root@localhost afsane]# ip addr 1: lo: 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: ens33: mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 00:0c:29:7a:53:87 brd ff:ff:ff:ff:ff:ff – afsane Oct 01 '18 at 07:41
  • 3: virbr0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether 52:54:00:14:b1:67 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:14:b1:67 brd ff:ff:ff:ff:ff:ff – afsane Oct 01 '18 at 07:41
  • everything is fine with "/etc/sysconfig/network-scripts/ifcfg-ens33" file, i mean the "BOOTPROTO" set for dhcp and "ONBOOT" is yes! – afsane Oct 01 '18 at 07:50
  • Ok, then issue lies with workstation virtual network. Please verify settings under: Edit>Virtual network editor. Verify that interface is NAT-ed, and that you have DHCP enabled. – Nik Oct 01 '18 at 08:02
  • Also verify your VM's network settings under: VM>Settings. I use NAT Network connection setting (Bridged does not work for me on laptop, probably due to lack of ethernet port). – Nik Oct 01 '18 at 08:06
  • both of them are NAT (under editor and Settings)!! – afsane Oct 01 '18 at 08:14
  • I changed my "ifcfg-ens33" file and "network" file and "resolv.conf" file based on the first answer here "https://superuser.com/questions/901672/centos-7-ping-8-8-8-8-connect-network-is-unreachable?rq=1" so the output of "ping 8.8.8.8" is changed to PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 10.0.0.10 icmp_seq=1 Destination Host Unreachable – afsane Oct 01 '18 at 08:16
  • so the output of "ifconfig" is looks like this now!:ens33: flags=4099 mtu 1500 inet 10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255 ether 00:0c:29:7a:53:87 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 – afsane Oct 01 '18 at 08:29
  • lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 710 bytes 73392 (71.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 710 bytes 73392 (71.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 – afsane Oct 01 '18 at 08:30
  • virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:14:b1:67 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 – afsane Oct 01 '18 at 08:30
  • Simple yet powerful! Tried various solutions except `dhclient`. Thanks for your answer. – harshavmb Apr 24 '19 at 08:44
0

You should check your Virtual Machine network config in order to be sure the network adapter is properly mapped. The best way in my opinion is not to NAT, but bridge the adapter to the phisical host apadter. Then your router dhcp server will provide a correct IP to your Centos virtual machine. Anyway you would need to check the Centos network configuration to see if the ip was assigned properly as long as it is the default gateway and DNS server.

Abraham
  • 85
  • 1
  • 2
  • 14
  • i reinstall my centOs and this time instead of GUI i choose GNOME so the internet works fine now. i really don't understand what is going on here but unfortunately i have really tied deadline so i am gonna leave it here. maybe some other time i will figure out why it was not work in GUI!!! Thanks again for your time – afsane Oct 01 '18 at 14:10