1

I'm using VBox. I have got a Bridged Adapter. I need to get my network working. What I can already do is to set everything up manually, I mean:

ifconfig eth0 192.168.1.33 netmask 255.255.255.0
route add default gw 192.168.1.1

This way I have an internet connection. My question is: How to obtain IP address/netmask/gw from DHCP on Kali Linux? I can't figure out how it works... I tried to edit my /etc/network/interfaces to have auto eth0 with DHCP and restarting service. This didn't work. I don't even get IPv4 address, only IPv6 one and I don't have network connection then. dhclient eth0 doesn't work for me aswell. What am I doing wrong?

  • Please post your /etc/network/interfaces – Rui F Ribeiro Jan 5 '16 at 11:43
2

I have found the same problem when using DHCP in bridged mode. I prefer to use DHCP for the same reasons.

I perform the following commands and it brings the interface up and obtains an IP address.

ipconfig eth0 up
dhclient eth0

This works on Kali 2 - not sure why it doesn't do this automatically, I will look into it when I get a chance.

1

I've had this issue on boot up, for some weird reason, my eth0 (primary network card) didn't pickup my DHCP settings either at all, or entirely.

I got around it with this as you've seen in the post from Security Beast Dec 17 '14 at 5:28 :

ifconfig eth0 down  # tear eth0 down/drop its current DHCP settings
ifconfig eth0 up    # bring it back up
dhclient eth0       # poll for new and complete DHCP settings which include the default gatway

I've even taken it one step further and added it to the Kali startup script in /etc/rc.local. You can either manually add these lines before the exit 0 line:

ifconfig eth0 down
ifconfig eth0 up
dhclient eth0

Boot up obtains the DHCP settings correctly every time now.

  • No one reading this would know what "prev post" you had on your mind. If you refer to something, provide a full reference. – techraf Apr 2 '16 at 12:58
1

Ideally dhclient-eth0 should work but as you don't have network connection its not possible to obtain ip address via dhcp you have few work work around

if you just want internet on kali make network adapter on NAT this will give you internet access

You can use BRIDGE MODE and gnome-network-manager to configure it via GUI by right clicking on network connection and edit connection and put you network ip address their

if you want to do it command line edit /etc/network/interface with following entries iface interface inet static address Your-ip netmask Your netmask gateway your gateway

  • This is exactly what I'm doing at the moment and what I mentioned in my question. But thanks for reply anyways! – Pijotrek Dec 17 '14 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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