No longer able to reach the Internet on Kali Linux

165,029

Solution 1

You have posted three problems.

$ ping www.google.com
ping: unkown host google.com

Your DNS servers aren't reachable (or likely aren't set at all).

$ ping 8.8.8.8 
connect: network is unreachable

You most likely don't have a default gateway set so your system doesn't know how to route the traffic.

$ cat /etc/network/interfaces
cat: /etc/network/interfaces: Permission denied

You need to elevate your user to root in order to manage some files (like interfaces).

You need to find a number of things. First check if you have an IP address at all:

sudo ifconfig -a

You will most likely see an eth0 with no inet addr:. If this is the case you may be able to fix your problems with a single command:

sudo dhclient eth0

If not we can keep trying.

Since dhclient didn't solve the problem, you should make sure your VM is configured correctly. What are the network settings on VirtualBox?

and what is the output of sudo ifconfig -a?

You can try sudo dhclient wlan0. If that doesn't work. Post the results of:

sudo cat /etc/network/interfaces

and

route -n

We can come back and try to trouble shoot the bridged network but lets try to get the VM working first (since bridged mode adds some other options for why it's not working). In virtualbox set the networking to NAT and "reboot" the VM. Does the eth0 interface get an IP?

I'm pretty surprised that you don't get an address after rebooting the VM when virtualbox is set in NAT mode...You can try to get any networking:

On the host machine, get your IP. it's probably a 192.168.x.x address. Also check the subnet mask (probably listed as /24 or 255.255.255.0 but it could be something else). In windows you can do this from cmd with:

ipconfig/all

Now you should have an address and subnet lets say windows reported your IP as 192.168.0.2 with a mask of 255.255.255.0. Manually put the VM on the same network and see if you can ping both ways. In the VM:

sudo ifconfig eth0 192.168.0.3/24

Confirm that you can see your new address with:

sudo ifconfig eth0

Now from the VM you should be able to ping the host:

ping 192.168.0.2

And from the host you should be able to ping the VM:

ping 192.168.0.3

Solution 2

SOLVED this issue on for myself on my macbook running Kali Linux. Go back into the network settings on virtual box, make sure it says 'Nat' and below that click advanced settings. Make sure "cable connected" is selected and start up your Kali Linux! Bam, you know have internet.

Solution 3

I faced similar problems, with the same configuration, Virtualbox with Kali Linux (2016.2). The Internet connection was working fine for a month and after it stopped..

By me dhclient showed that "smbd.service is not active" after restarting the smbd service everything is fine again.

Share:
165,029

Related videos on Youtube

dantosso
Author by

dantosso

i'm a doctor who failed in medecin because i discovered (unfortunatley so late) that my real passion is computers so i try hardly to learn hacking because i know i was so smart once ... i love peaople who have computer skills and i envy them so plz feel free to contact me if you want to help me or show me the way to the top thanks

Updated on September 18, 2022

Comments

  • dantosso
    dantosso over 1 year

    I'm running Kali Linux on VirtualBox and trying to learn some of its basics. I know it's based on Debian but I come from Windows so I'm new to Linux and networking in general.

    My problem is that while I already connected Kali to the Internet and used Iceweasel many times, now, after some manipulations I did on the terminal, I can't reach the Internet anymore, even if I connect to my wifi network.

    I tried the following:

    $ ping www.google.com
    ping: unkown host google.com
    
    $ ping 8.8.8.8 
    connect: network is unreachable
    
    $ cat /etc/network/interfaces
    cat: /etc/network/interfaces: Permission denied
    

    I think my virtualbox settings are ok because I already surfed the internet before this problem came on but here are the settings. I use a bridged mode on wifi intel(R) 5100agn in advanced tab I have all allowed and I use a usb ralink wifi adapter linked to the virtual machine.

    Here is an image of the output of ifconfig -a

    enter image description here

    keep updating and here is the result of " cat /etc/network/interfaces " and " route -n"

    enter image description here

    After changing the vbox settings from bridged to nat nothing changed -- still don't have an ip adress.

    • Admin
      Admin over 9 years
      Post the result of ifconfig, please.
  • dantosso
    dantosso over 9 years
    first thank all of you for your effort yes you're right, i dont have inet addr but i already tried the dhclient eth0 (without sudo the first time ) and it didnt work and sorry i forgot the "cat" before the network/interfaces so now it shows me " auto lo iface lo inet loopback
  • Jonathan Roberts
    Jonathan Roberts over 9 years
    Does the dhclient command fix your issue?
  • dantosso
    dantosso over 9 years
    no dhclient did'nt fix it ... i still dont have any inet on eth0
  • yorkshiredev
    yorkshiredev over 9 years
    @dantosso Please be more specific with your errors, "it doesn't work" or "it didn't fix" is definitely not helpful. When attempting something, please edit your question and put in your results so we can have more details about the error you're actually getting (and don't forget: 4 spaces before each line of code/console output to get a decent formatting).
  • dantosso
    dantosso over 9 years
    @jhon yes sorry for that ... my secandary probleme is that i cant install the "guest additions " of virtualbox on kali for uknown reason and because of that i can't copy from my guest kali machine to this host, so i'm obliged to type manually all the commands ... dhclient work and doesn't show any msg after i type it but it does'nt fix the problem ... sorry again for my rediculus formatting
  • Jonathan Roberts
    Jonathan Roberts over 9 years
    @dantosso you can add to your post and i'll add to my answer as we go rather than have 100 comments.
  • Jonathan Roberts
    Jonathan Roberts over 9 years
    @dantosso any luck?
  • dantosso
    dantosso over 9 years
    @user1794469 first plz excuse me bcause i was busy for a while ... yesterday i instaled it again on a new virual machine with vbox to make a comparision and the inetrnet just worked fine with the nat but when i swithced to bridge it went off then i tried the bridged mode but instead of using wifi intel(R) 5100agn i choosed the other option wich is broadcom ( or something like that ) and it all works fine for me ..... but most of all i have to thank you because you knew that the prob is on vbox settings and mostly because you helped me to the end so great thank to you
  • Aralox
    Aralox about 7 years
    This also allowed me to access the internet through my phones hotspot on a physical Kali machine. Thanks!
  • Jithin Pavithran
    Jithin Pavithran about 7 years
    Bridged and Nat are different modes. Nat mode can't give you separate global ip. (Nat mode will put your connection in the local network under your primary OS.)
  • n00b
    n00b almost 6 years
    This fixed it for me. To start this service run 'service smbd start'
  • n00b
    n00b over 5 years
    I switched from NAT to bridged (the opposite of what you suggested) and that worked for me. I know its not fixing the root issue but not going to bother with troubleshooting for now.
  • RolandMakkelie
    RolandMakkelie about 2 years
    you fucking brilliant man!