dhcpcd-discuss

Re: How to prevent bringing interface up on system startup and be able to bring it up manually

Роман Мещеряков

Mon May 29 10:23:52 2017

Hi Roy,

I still didn’t manage to solve the subj problem in a convenient way and feel myself lost.

My current configuration regarding eth0 and wlan0 interfaces is the following:

 

 

/etc/network/interfaces:

...

iface eth0 inet manual

 

iface wlan0 inet manual

   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

 

 

/etc/dhcpcd.conf:

...

# Trace debug messages

debug

 

# Automatically bring up only eth0

allowinterfaces eth0

 

 

After booting Raspberry Pi with this configuration I get the following behaviour:

  1. eth0 is bringed up and got it’s IPv4 address from router’s DHCP server (as expected)

  2. wlan0 isn’t bringed up (as expected)

 

Then I issue the “sudo dhcpcd --rebind wlan0” command. In response to this action I get the following:

  1. wlan0 is bringed up, but has no IP address assigned. Wi-Fi network router is OK, checked. (not as expected, expected behavior is: IPv4 address from Wi-Fi network router assigned)

 

There are the following lines regarding wlan0 in the /var/log/syslog after --rebind command:

 

2017-05-29T13:05:40.758115+03:00 masternoinit dhcpcd[878]: sending commands to master dhcpcd process

2017-05-29T13:05:40.759778+03:00 masternoinit dhcpcd[878]: send OK

2017-05-29T13:05:40.760349+03:00 masternoinit dhcpcd[599]: control command: dhcpcd --rebind wlan0

2017-05-29T13:05:40.765085+03:00 masternoinit dhcpcd[599]: wlan0: disabling kernel IPv6 RA support

2017-05-29T13:05:40.766745+03:00 masternoinit dhcpcd[599]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT

2017-05-29T13:05:40.779634+03:00 masternoinit dhcpcd[599]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER

2017-05-29T13:05:40.874355+03:00 masternoinit dhcpcd[599]: wlan0: waiting for carrier

2017-05-29T13:05:40.875195+03:00 masternoinit dhcpcd[599]: wlan0: carrier acquired

2017-05-29T13:05:40.875876+03:00 masternoinit dhcpcd[599]: wlan0: adding address fe80::24a3:7e0e:3683:c71f

2017-05-29T13:05:40.877348+03:00 masternoinit dhcpcd[599]: wlan0: pltime infinity, vltime infinity

2017-05-29T13:05:40.878131+03:00 masternoinit dhcpcd[599]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' CARRIER

2017-05-29T13:05:40.882477+03:00 masternoinit dhcpcd[599]: wlan0: IAID eb:25:fa:7b

2017-05-29T13:05:40.883536+03:00 masternoinit dhcpcd[599]: wlan0: delaying IPv6 router solicitation for 0.0 seconds

2017-05-29T13:05:40.884522+03:00 masternoinit dhcpcd[599]: wlan0: delaying IPv4 for 0.0 seconds

2017-05-29T13:05:40.885326+03:00 masternoinit dhcpcd[599]: wlan0: carrier lost

2017-05-29T13:05:40.885981+03:00 masternoinit dhcpcd[599]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER

2017-05-29T13:05:40.931528+03:00 masternoinit dhcpcd[599]: wlan0: deleting address fe80::24a3:7e0e:3683:c71f

 

So I don’t know what is the problem with my configuration. Roy and others, I would be very grateful for your help!

 
-- 
Kind regards, Roman Mescheryakov
 
 
 
15.04.2017, 15:33, "Роман Мещеряков" <romanmescheryakov@xxxxxxxxx>:
Hi Roy,
 
Thank you for quick response!
 
> Why?
 
RPi-based system I'm developing will get it's internet access via Ethernet interface and will not need Wi-Fi at all. Ethernet interface will be connected to Wi-Fi router which will connect to internet using USB 3G/4G modem attached to it.
But in the process of development it's convenient to get internet on RPi via built-in Wi-Fi. But I prefer Wi-Fi to be down by default in order to be sure it will not create mess in network routes or by other means. I think for complicated systems it's generally good idea to keep unused components disabled. Also from security point of view: enabled Wi-Fi is potential security hole.
 
>But in answer to your question, you should be able to do this.
>In dhcpcd.conf put:
>allowinterfaces eth0

>This makes dhcpcd start eth0 only.
>You can then go onto start wlan0 like so
>dhcpcd -n wlan0
 
I tried this with dhcpcd 6.7.1, but it didn't work: after issuing "dhcpcd -n wlan0" nothing happened, wlan0 remained down.
I supposed this could be fixed already in a newer dhcpcd version, so I installed version 6.10.1-1 manually from here. Things changed a bit: now after issuing "rebind" wlan0 is bringed up, but it has no IPv4 address assigned.
It is also strange that despite "debug" option in /etc/dhcpcd.conf there are no "wlan0" mentions in /var/log/syslog after issuing "dhcpcd --rebind wlan0".
You can see commands I typed and their output in the "commands.txt" file attached. Also attached /etc/dhcpcd.conf and /etc/network/interfaces used.
 
-- 
Kind regards, Roman Mescheryakov
 
 
 
14.04.2017, 22:13, "Roy Marples" <roy@xxxxxxxxxxxx>:

Hi

On 14/04/17 15:43, Роман Мещеряков wrote:

 I have Raspberry Pi (RPi) mini-PC with Raspbian OS which is adaptation
 of Debian. RPi model 3 B has 2 built-in network interfaces: Ethernet
 (eth0) and Wi-Fi (wlan0). As far as I know, in Raspbian it is dhcpcd
 that manages network configuration.


By default this is the case.
 

 I need to configure it in such a way that on system startup only eth0 is
 brought up. At the same time I need opportunity to bring up wlan0 at any
 time with simple command like “ifconfig wlan0 up” or “ifup wlan0”. I
 read “man dhcpcd.conf” and tried using “denyinterfaces wlan0”
 configuration option, but this seems to make wlan0 completely out of
 dhcpcd’s control. Is it possible to configure dhcpcd to get the result
 desired?


Why?

With both brought up and connected, dhcpcd should prefer eth0 over wlan0
all the time. Although both will have IP addresses, routes and gateways,
eth0 will have the lower metric to ensure it gets all the traffic - the
premise being that wired is faster than wireless (this isn't 100%, but
is a good default).

But in answer to your question, you should be able to do this.
In dhcpcd.conf put:
allowinterfaces eth0

This makes dhcpcd start eth0 only.
You can then go onto start wlan0 like so
dhcpcd -n wlan0

This should notify dhcpcd via it's control socket to start wlan0 and
should bring it up.
 

 dhcpcd version installed in Raspbian by default is 6.7.1.


That's getting old now, but no reason why it shouldn't work.

Roy


Follow-Ups:
Re: How to prevent bringing interface up on system startup and be able to bring it up manuallyRoy Marples
References:
How to prevent bringing interface up on system startup and be able to bring it up manuallyРоман Мещеряков
Re: How to prevent bringing interface up on system startup and be able to bring it up manuallyRoy Marples
Re: How to prevent bringing interface up on system startup and be able to bring it up manuallyРоман Мещеряков
Archive administrator: postmaster@marples.name