Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

stop dhcp requests

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
ychaouche
Posts: 87
Joined: 2014-12-11 09:45

stop dhcp requests

#1 Post by ychaouche »

hello

I have changed the config of my machine from dhcp to static but it keeps sending DHCP requests over the network. What are my options to stop the DHCP requests ?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: stop dhcp requests

#2 Post by Head_on_a_Stick »

ychaouche wrote:I have changed the config of my machine from dhcp to static
How did you do that? Please post the exact command(s) and/or configuration file(s).
ychaouche wrote:it keeps sending DHCP requests over the network
How do you know that? Please post the exact command(s) and/or tool(s).

We should probably also check your enabled services:

Code: Select all

ls -lR /etc/systemd/system
deadbang

ychaouche
Posts: 87
Joined: 2014-12-11 09:45

Re: stop dhcp requests

#3 Post by ychaouche »

You asked for it

Code: Select all

ip a
ip a ens192
ip a -d ens192
ip -d ens192 a
man ip
ls
dpkg -s isc-dhcp-client
echo $PATH | tr ":" "\n"
whoami
echo $PATH | tr ":" "\n"
ip a
dhclient ens192
dhclient -v ens192
ip addr add 10.10.10.84 dev ens192
ip a dev ens192
ip addr show
ip addr show 2
ip addr show ens192
ip addr del 172.16.10.183 dev ens192
ip addr show ens192
ip addr del 10.10.10.84/32 dev ens192
ip addr show ens192
ip addr add 10.10.10.84/24 dev ens192
ip addr show ens192
ip route add default via 10.10.10.10/24
ip route show
ping 10.10.10.19
ping 10.10.10.10
ifdown ens192
ifup ens192
ip addr show ens192
ip addr add 10.10.10.84/24 dev ens192
ip route show
ip route show
roue
route
route
ip route show
y
ip route show
ip route del 10.10.10.10
ip route show
ip route delete 10.10.10.10/24
ip route delete 10.10.10.0/24 via 10.10.10.10
ip route delete 10.10.10.0/24 via 10.10.10.10 dev ens192
ip route show
ip route delete 10.10.10.0/24 dev ens192
ip route show
ip route add default via 10.10.10.10 dev ens192
ip route add default via 10.10.10.10
ip route add default via 10.10.10.10ip route show
ip route add default via 10.10.10.10
ip route
ip route
reboot
cp --parents
cp --parent
cp --pare
cp --parents .ssh/authorized_keys .
cp --parents .ssh/authorized_keys ~/
cat ~/.ssh/authorized_keys
ip addr show ens192
ip addr add 10.10.10.84/24 dev ens192
ip route
ip addr show dev ens192
ip route add default via 10.10.10.10
ip route
ping 10.10.10.10
ping 10.10.10.19
ping 10.10.10.21
ip addr show dev ens192
ping 10.10.10.84
ping 10.10.10.10
route
ip route show
ip route add default via
ip route show
ping 10.10.10.10
ping 10.10.10.19
nmap
ping 10.10.10.19
ping 10.10.10.19
ip addr show
I issued a few ip commands until I found out the problem wasn't on the host but on the VM network config...

The DHCP requests are in the syslog :
Mar 23 11:15:44 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 4
Mar 23 11:15:48 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 5
Mar 23 11:15:53 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 13
Mar 23 11:16:06 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 13
Mar 23 11:16:19 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 19
Mar 23 11:16:38 cloud dhclient[446]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 7
Mar 23 11:16:45 cloud dhclient[446]: No DHCPOFFERS received.
Mar 23 11:16:45 cloud dhclient[446]: No working leases in persistent database - sleeping.
I changed /etc/network/interfaces from dhcp to static but did not restart any networking service or called ifup/ifdown scripts. I just wanted to know if there was a way to granularly stop DHCP requests w/o restarting the whole networking service.

Code: Select all

root#cloud 11:22:02 ~ # cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens192
iface ens192 inet static
        address 10.10.10.84/24
        gateway 10.10.10.10
root#cloud 11:22:03 ~ #

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: stop dhcp requests

#4 Post by Head_on_a_Stick »

ychaouche wrote:I just wanted to know if there was a way to granularly stop DHCP requests w/o restarting the whole networking service.

Code: Select all

# pkill dhclient
deadbang

ychaouche
Posts: 87
Joined: 2014-12-11 09:45

Re: stop dhcp requests

#5 Post by ychaouche »

that's just perfect ! thanks a ton :) I usually think of programs like these to be daemons, never thought dhclient was a kind of daemon (or is it ?)

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: stop dhcp requests

#6 Post by p.H »

ychaouche wrote:I changed /etc/network/interfaces from dhcp to static but did not restart any networking service or called ifup/ifdown scripts. I just wanted to know if there was a way to granularly stop DHCP requests w/o restarting the whole networking service.
Do not restart the whole networking service. It does not work the way you think and does not do what you want.
The networking service has no configuration memory. All it knows about a given interface is whether it started it (status).

If you want to change the configuration for an interface,
1) Stop the interface with ifdown <interface>
2) Edit /etc/network/interfaces
3) Start the interface with ifup <interface>

If you do not stop the interface before changing it from dhcp to static, the networking service does not know it was using dhcp and does not stop the DHCP client.
ychaouche wrote:never thought dhclient was a kind of daemon (or is it ?)
It is.

Post Reply