5

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.

  • Post the result of ifconfig, please. – davidbaumann Jan 9 '15 at 22:04
7

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.

  • 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.) – Jithin Pavithran Mar 31 '17 at 6:20
  • 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. – n00b Jul 17 '18 at 1:29
3

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
  • 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 – dantosso Jan 9 '15 at 23:14
  • Does the dhclient command fix your issue? – user1794469 Jan 9 '15 at 23:20
  • no dhclient did'nt fix it ... i still dont have any inet on eth0 – dantosso Jan 9 '15 at 23:22
  • @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). – John WH Smith Jan 9 '15 at 23:24
  • @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 – dantosso Jan 9 '15 at 23:29
2

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.

  • This also allowed me to access the internet through my phones hotspot on a physical Kali machine. Thanks! – Aralox Mar 20 '17 at 2:30
  • This fixed it for me. To start this service run 'service smbd start' – n00b May 17 '18 at 17:54
0

first great thank to user1794469 for his help

after some manipulations with virtualbox network settings i found the solution to my probleme so here are the settings i used and worked fine for me

i choosed the bridge mode and in the next line, instead of having the wifi intel(R) 5100agn i choosed the broadcom netlink ... after all i think an img is better so here is the screenshot

enter image description here

i know the interface is in french buti think everything is clear.

now hopefully this will work for others ...

protected by Anthon Jan 14 '17 at 9:00

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.