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?

2 Answers 2

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

13
  • 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
    Commented Oct 1, 2018 at 7:30
  • Thanks @Nik, "dhclient" does not work. here is the out put of "ip addr":
    – afsane
    Commented Oct 1, 2018 at 7:40
  • [root@localhost afsane]# ip addr 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: ens33: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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
    Commented Oct 1, 2018 at 7:41
  • 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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
    Commented Oct 1, 2018 at 7:41
  • everything is fine with "/etc/sysconfig/network-scripts/ifcfg-ens33" file, i mean the "BOOTPROTO" set for dhcp and "ONBOOT" is yes!
    – afsane
    Commented Oct 1, 2018 at 7:50
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.

1
  • 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
    Commented Oct 1, 2018 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .