annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

How to boot faster (DHCP issue) when ethernet is unplugged?

Tue Jan 05, 2016 9:00 am

my system based on DietPi (Jessie) boots on 12 secs when ethernet is plugged in

however, when it is unplugged its DHCP will take around 1:25 minutes to continue the boot process...

does anyone know how to accelerate or skip this? my system is a embedded system in which it is critical fastest booting time

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 10:12 am

Remove the unused interfaces (NOT lo) from /etc/network/interfaces.
Configure /etc/dhcpcd.conf with a static IP address.
Or run a DHCP server on your RPi that will answer it's own request. That's not recommended because things will go wrong if you have two DHCP servers on your subnetwork.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 10:14 am

DougieLawson wrote:Remove the unused interfaces (NOT lo) from /etc/network/interfaces.
Configure /etc/dhcpcd.conf with a static IP address.
Or run a DHCP server on your RPi that will answer it's own request. That's not recommended because things will go wrong if you have two DHCP servers on your subnetwork.
how to make the DHCP server with static ip (consider many android clients may connect):

Code: Select all

#
# Sample configuration file for ISC dhcpd for Debian
#
#

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;


subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.50;
}


# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

#subnet 10.254.239.0 netmask 255.255.255.224 {
#  range 10.254.239.10 10.254.239.20;
#  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet 10.254.239.32 netmask 255.255.255.224 {
#  range dynamic-bootp 10.254.239.40 10.254.239.60;
#  option broadcast-address 10.254.239.31;
#  option routers rtr-239-32-1.example.org;
#}

# A slightly different configuration for an internal subnet.
#subnet 10.5.5.0 netmask 255.255.255.224 {
#  range 10.5.5.26 10.5.5.30;
#  option domain-name-servers ns1.internal.example.org;
#  option domain-name "internal.example.org";
#  option routers 10.5.5.1;
#  option broadcast-address 10.5.5.31;
#  default-lease-time 600;
#  max-lease-time 7200;
#}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
#  hardware ethernet 0:0:c0:5d:bd:95;
#  filename "vmunix.passacaglia";
#  server-name "toccata.fugue.com";
#}

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
#  hardware ethernet 08:00:07:26:c0:a5;
#  fixed-address fantasia.fugue.com;
#}

# You can declare a class of clients and then do address allocation
# based on that.   The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.

#class "foo" {
#  match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
#}

#shared-network 224-29 {
#  subnet 10.17.224.0 netmask 255.255.255.0 {
#    option routers rtr-224.example.org;
#  }
#  subnet 10.0.29.0 netmask 255.255.255.0 {
#    option routers rtr-29.example.org;
#  }
#  pool {
#    allow members of "foo";
#    range 10.17.224.10 10.17.224.250;
#  }
#  pool {
#    deny members of "foo";
#    range 10.0.29.10 10.0.29.230;
#  }
#}

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 10:48 am

That sample dhcpd.conf file gives you lots of examples for lots of cases. Pick one that matches what you're trying to achieve (which is something that only you know).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 11:32 am

DougieLawson wrote:That sample dhcpd.conf file gives you lots of examples for lots of cases. Pick one that matches what you're trying to achieve (which is something that only you know).
My solution already works (provide AP connection to several android ftp clients via the same IP), with or wihout ethernet internet access

the problem is how to shorten the time (1:30 minutes) taken or skip when booting searching for DHCP IP if ethernet is unplugged

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 11:38 am

If ethernet is unplugged then DHCP shouldn't be attempting to activate the interface. Try changing

Code: Select all

auto eth0
to

Code: Select all

allow-hotplug eth0
in your interfaces file. If it comes up active DHCP will dither/timing out until it's decided that there's no DHCP server responding then will allocate a 169.254.xxx.xxx address. I guess that's delaying your boot.

You'll also want to disable "4 Wait for Network at Boot Choose whether to wait for networ" in raspi-config.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 11:52 am

DougieLawson wrote:If ethernet is unplugged then DHCP shouldn't be attempting to activate the interface. Try changing

Code: Select all

auto eth0
to

Code: Select all

allow-hotplug eth0
in your interfaces file. If it comes up active DHCP will dither/timing out until it's decided that there's no DHCP server responding then will allocate a 169.254.xxx.xxx address. I guess that's delaying your boot.

You'll also want to disable "4 Wait for Network at Boot Choose whether to wait for networ" in raspi-config.
thanks Doug I think ur the top1 helpful guy here :ugeek: btw dietpi does not have raspi-config

I added the line you said (didn't have auto eth0) but didn't work, anyways this is my interfaces

Code: Select all

#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.

# Local
auto lo

iface lo inet loopback
#iface eth0 inet dhcp 
iface eth0 inet static
address 192.168.1.81
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254


#allow-hotplug wlan0
#iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

auto br0
iface br0 inet static
bridge_ports eth0 wlan0
address 192.168.0.199
broadcast 192.168.0.255
netmask 255.255.255.0
gateway 192.168.0.1

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 12:25 pm

You never said you were using diet-pi. It's not got the stuff that arrived with raspberrypi-net-mods (which improved the GUI for WiFi but forgot the needs of the headless users).

Has diet-pi gone to Jessie and systemd yet? Because you may need to ask the diet-pi developer to help with your slow boot problem.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

annlee
Posts: 111
Joined: Thu Sep 03, 2015 5:32 am

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 12:27 pm

DougieLawson wrote:You never said you were using diet-pi. It's not got the stuff that arrived with raspberrypi-net-mods (which improved the GUI for WiFi but forgot the needs of the headless users).

Has diet-pi gone to Jessie and systemd yet? Because you may need to ask the diet-pi developer to help with your slow boot problem.
diet-pi is wonderful, u should try, it has headless and many fast options and also on Jessie

I am searching someone on fiverr since it seems kinda hard to fix issue

fourdee4d
Posts: 362
Joined: Mon Sep 17, 2012 10:31 pm
Location: East Midlands, UK
Contact: Website

Re: How to boot faster (DHCP issue) when ethernet is unplugg

Tue Jan 05, 2016 2:28 pm

annlee wrote:
DougieLawson wrote:If ethernet is unplugged then DHCP shouldn't be attempting to activate the interface. Try changing

Code: Select all

auto eth0
to

Code: Select all

allow-hotplug eth0
in your interfaces file. If it comes up active DHCP will dither/timing out until it's decided that there's no DHCP server responding then will allocate a 169.254.xxx.xxx address. I guess that's delaying your boot.

You'll also want to disable "4 Wait for Network at Boot Choose whether to wait for networ" in raspi-config.
thanks Doug I think ur the top1 helpful guy here :ugeek: btw dietpi does not have raspi-config

I added the line you said (didn't have auto eth0) but didn't work, anyways this is my interfaces

Code: Select all

#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.

# Local
auto lo

iface lo inet loopback
#iface eth0 inet dhcp 
iface eth0 inet static
address 192.168.1.81
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254


#allow-hotplug wlan0
#iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

auto br0
iface br0 inet static
bridge_ports eth0 wlan0
address 192.168.0.199
broadcast 192.168.0.255
netmask 255.255.255.0
gateway 192.168.0.1
Dougie was right, you only needed to change auto eth0 to allow-hotplug eth0. As you have highly modified your interfaces config file, you may wish to use the original as a reference https://github.com/Fourdee/DietPi/blob/ ... interfaces

Another option would be to give the eth0 device a static IP. This would disable the DHCP client.

We have a DietPi-Software WiFi hotspot installation coming in the next DietPi update (v105). This will setup and configure your system for a WiFi hotspot automatically.
You never said you were using diet-pi. It's not got the stuff that arrived with raspberrypi-net-mods (which improved the GUI for WiFi but forgot the needs of the headless users).
DietPi-Config has a lightweight WiFi connection and configuration tool using whiptail (allowing use over SSH). We dont need the raspberrypi-net-mods package.
DietPi.com - Lightweight justice for your Raspberry Pi. Optimized, simplified linux for everyone
DietPi's web hosting is powered by MyVirtualServer.com

Return to “Beginners”