Where's my dhclient? (Kali Linux) [SOLVED]

thewetmosquito

New Member
Credits
80
Hello everyone, new guy here. New to Linux, and am currently reading the book Linux Basics for Hackers to get basic command line knowledge of working in Linux, but I'm feeling lost. I am running Kali Linux 2020.2 through Oracle VirtualBox 6.1.10 on my 2012 Macbook Pro(OSX 10.14.6), and I am operating as root user.

I have been trying to input the command dhclient eth0 as instructed by this book to request an IP address from DHCP, but I keep getting back the error -bash: dhclient: command not found... I also used /usr/sbin/dhclient eth0 and sudo dhclient eth0, and got the same error message.

I ran find -name dhclient to see if I even have the DHCP client installed on my system. Bash returns nothing :(

I'm not sure if I have to configure something before using the dhclient or what. I haven't found a solution to this on the web yet. I'm pretty new to the online community of Linux and programming, so I turned to StackExchange for help...and received a very toxic experience (a user pretty much closed my question because they don't 'allow questions about general computing'.)

Can anyone shed some light on my newbie problem?
 


captain-sensible

Well-Known Member
Credits
3,746
I think I once glanced over it.competent use of command line is going to be required to do most of the useful stuff. Thus really there is a lot of choice. A book with title hacking is about marketing . Most Linux books are going to cover the same ground.
 

thewetmosquito

New Member
Credits
80
I think I once glanced over it.competent use of command line is going to be required to do most of the useful stuff. Thus really there is a lot of choice. A book with title hacking is about marketing . Most Linux books are going to cover the same ground.
Yea, I definitely was sold on the whole "hacking" title, and saw from the reviews that it was just beginner level linux things. I'm a week and a half in on my path to Linux, and I don't feel too intimidated though. I'm actually coming to learn that I enjoy inputting commands and coding more than my current profession, web designing.

So far I'm familiarized with how to do basic navigation and file editing commands. A lot of stuff I've done in Linux I had to go out and seek further knowledge. I spend 50% of my time in that book, and another 50% learning outside(maybe more than I should at my skill level). The fact that I'm only scratching the surface is awe inspiring.

I do, however, really want to get my dhclient up and running, but i haven't found the solution.
I referenced this video on how to install the DHCP server in Linux, but it didn't work out.
I also referenced this HiRoom Instructional, and it didn't work.

Maybe this problem is trivial, and I can continue learning without but it's been consuming my mind.
 

captain-sensible

Well-Known Member
Credits
3,746
right, basically when you connect to the internet via your isp router your PC will be "leased" an IP address.

To play with this you need to be root

Slackware : su -> rootpassword -> #

or sudo command

while connected to the internet try:

sudo dhclient -v


eg on my slackware :

Code:
dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/48:89:e7:3b:12:80
Sending on LPF/wlan0/48:89:e7:3b:12:80
Listening on LPF/eth0/f8:b4:6a:e9:61:87
Sending on LPF/eth0/f8:b4:6a:e9:61:87
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 192.168.0.102 from 192.168.0.1
DHCPREQUEST for 192.168.0.102 on wlan0 to 255.255.255.255 port 67
DHCPACK of 192.168.0.102 from 192.168.0.1
RTNETLINK answers: File exists
bound to 192.168.0.102 -- renewal in 38526 seconds.
bash-5.0#
so the "lease" is for
38526 seconds

# dhclient wlan0
RTNETLINK answers: File exists


the above is talking about routing table, so flushing and all that stuff
 

captain-sensible

Well-Known Member
Credits
3,746
i did once set up dnsmasq on a PC which is where you may not want to be on the Internet but may want an Intranet and lease IP'S to say Window clients, then with Samba they can access files on the Linux PC .eg set up for small schools where Linux PC has say wikipedia html files
 

captain-sensible

Well-Known Member
Credits
3,746
I will give you a good tip as told to me while learning Java- if you don't understand something keep reading until you do ! Actually you will be surprised what you have no clue on one week and then weeks down the road it makes sense.

Then pattern of course goes on over the years.. welcome to linux !
 

thewetmosquito

New Member
Credits
80
I will give you a good tip as told to me while learning Java- if you don't understand something keep reading until you do ! Actually you will be surprised what you have no clue on one week and then weeks down the road it makes sense.

Then pattern of course goes on over the years.. welcome to linux !
Thank you! Very welcoming community. Unlike StackOverflow
 

captain-sensible

Well-Known Member
Credits
3,746
Stack Overflow is where you go , when you have low blood pressure.
Now its time to use lateral thinking. There is a book that suggests using kali and they don't mention installing dhclient ? i don't think so .Anyway i'm here via live kali

your find syntax might be missing type , name and that sort of thing but i can confirm that live kali :
[email protected]:~$ sudo dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/48:89:e7:3b:12:80
Sending on LPF/wlan0/48:89:e7:3b:12:80
Listening on LPF/eth0/f8:b4:6a:e9:61:87
Sending on LPF/eth0/f8:b4:6a:e9:61:87
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
^C
[email protected]:~$ whereis dhclient
dhclient: /usr/sbin/dhclient /usr/share/man/man8/dhclient.8.gz
[email protected]:~$

thus i think the tree to bark up must be concerning virtualbox? why don't you just stick live on a usb ?
 

thewetmosquito

New Member
Credits
80
if that fails then try
Code:
apt install dhcpcd5
Hey @Tolkem, thank you for responding!

I ran the apt install dhcp-client, and it returned:
[COLOR=rgb(184, 49, 47)][B]E:[/B][/COLOR] Package 'dhcp-client' has no installation candidate

So, I ran apt install dhcpcd5, and it was a successful install. Ran the dhcpcd5, and it returned a lot of information about routing, leasing, and hardware addresses(good). It also returned
Failed to try-restart systemd-timesyncd.service: Unit systemd-timesyncd.service is masked.. Should I be worried about this?

Thank you again!
 

thewetmosquito

New Member
Credits
80
thus i think the tree to bark up must be concerning virtualbox? why don't you just stick live on a usb ?
I tried burning an .iso to my usb using balenaEtcher, and tried to boot it to my Mac instead of going by the book and using VirtualBox. I ran into a lot of trivial problems like balenaEtcher killing my USB. It wasn't a problem at first because my Mac could still boot into the usb, but when I went through the install and configuration of Kali Linux on my Mac that parsing part really became a problem, and it prevented me from moving forward.

I had usb1(the one that has the .iso) and usb2(the one that I was going to place Kali Linux on), and for some reason I was having issues with the usb that I had bought, so I just said to heck with it and went the virtualBox way.
 

Tolkem

Well-Known Member
Credits
1,300
It also returned
Failed to try-restart systemd-timesyncd.service: Unit systemd-timesyncd.service is masked.. Should I be worried about this?
You're welcome! :) I don't think so. First, you're running kali in a VM and second, that service is time synchronization which frankly you can live without.
 

thewetmosquito

New Member
Credits
80
You're welcome! :) I don't think so. First, you're running kali in a VM and second, that service is time syncrhonization which frankly you can live without.
Also after analyzing the problem, I realized that my wifi was not working inside my VM. It dawned on me when I tried to go into FireFox and email some code snippets. I connected it to LAN, and both the isc-dhcp-client and dhcpcd5 worked smoothly. Which makes sense because I would need a wireless connection to pull packages from repositories, right?

A new problem to tackle after I get some grub o_O
 

Tolkem

Well-Known Member
Credits
1,300
Also after analyzing the problem, I realized that my wifi was not working inside my VM
That's the expected behaviour. VBox doesn't offer wifi by default, there's a way though by using a USB wifi adapter and attach it to the VM. VBox uses a virtual wired network.
 


Members online


Top