Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #9010 > unrolled thread

Re: Raspbian boots to a DHCP address first, then the fixed IP

Started byAdam Funk <a24061@ducksburg.com>
First post2015-07-01 21:45 +0100
Last post2015-07-03 06:16 +0100
Articles 11 — 5 participants

Back to article view | Back to comp.sys.raspberry-pi

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Raspbian boots to a DHCP address first, then the fixed IP Adam Funk <a24061@ducksburg.com> - 2015-07-01 21:45 +0100
    Re: Raspbian boots to a DHCP address first, then the fixed IP Rob <nomail@example.com> - 2015-07-01 21:06 +0000
      Re: Raspbian boots to a DHCP address first, then the fixed IP Adam Funk <a24061@ducksburg.com> - 2015-07-02 10:16 +0100
        Re: Raspbian boots to a DHCP address first, then the fixed IP Rob <nomail@example.com> - 2015-07-02 12:12 +0000
    Re: Raspbian boots to a DHCP address first, then the fixed IP Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-01 22:12 +0000
      Re: Raspbian boots to a DHCP address first, then the fixed IP Adam Funk <a24061@ducksburg.com> - 2015-07-02 10:32 +0100
        Re: Raspbian boots to a DHCP address first, then the fixed IP The Natural Philosopher <tnp@invalid.invalid> - 2015-07-02 10:53 +0100
    Re: Raspbian boots to a DHCP address first, then the fixed IP Adam Funk <a24061@ducksburg.com> - 2015-07-02 19:40 +0100
      Re: Raspbian boots to a DHCP address first, then the fixed IP Rob <nomail@example.com> - 2015-07-02 19:30 +0000
        Re: Raspbian boots to a DHCP address first, then the fixed IP Adam Funk <a24061@ducksburg.com> - 2015-07-02 20:56 +0100
          Re: Raspbian boots to a DHCP address first, then the fixed IP Dom <domafp@blueyonder.co.uk> - 2015-07-03 06:16 +0100

#9010 — Re: Raspbian boots to a DHCP address first, then the fixed IP

FromAdam Funk <a24061@ducksburg.com>
Date2015-07-01 21:45 +0100
SubjectRe: Raspbian boots to a DHCP address first, then the fixed IP
Message-ID<c30e6cx3hc.ln2@news.ducksburg.com>
On 2015-07-01, Dom wrote:

> On 01/07/15 13:11, Adam Funk wrote:
>> I have a Pi using only the /boot partition on the SD card, with
>> /boot/cmdline.txt set to mount / from a partition on the external USB
>> drive, & I edited /etc/network/interfaces to use a fixed IP address on
>> the LAN.  But I've noticed that when I reboot it, it comes up with a
>> DHCP address first, then changes to the fixed IP.  What have I done
>> wrong, & how do I fix it?
>>
>> Thanks.
>>
> Remove or disable the dhcpdc package. It's a recent addition to the 
> Rasbian images and tends to ignore the interfaces file and do its own thing.
>
> It's fine for the average user who uses the desktop and sets up 
> networking via the GUI, but just gets in the way when you want to do 
> things yourself.

Thanks.  Is removing it likely to break anything?  

I've never connected a keyboard, mouse, or monitor to this Pi --- I
just used dd to put the image on the SD card, put that in the Pi,
started it up, found it on the LAN (with a DHCP address) and used ssh
to do the rest (obviously changing the default password first...).
And I'd like to not have to dig out a spare keyboard (& so on) later
if it doesn't connect according to the static LAN IP for some reason.


-- 
I used to be better at logic problems, before I just dumped
them all into TeX and let Knuth pick out the survivors.
                                               -- plorkwort

[toc] | [next] | [standalone]


#9012

FromRob <nomail@example.com>
Date2015-07-01 21:06 +0000
Message-ID<slrnmp8lil.f61.nomail@xs8.xs4all.nl>
In reply to#9010
Adam Funk <a24061@ducksburg.com> wrote:
> On 2015-07-01, Dom wrote:
>
>> On 01/07/15 13:11, Adam Funk wrote:
>>> I have a Pi using only the /boot partition on the SD card, with
>>> /boot/cmdline.txt set to mount / from a partition on the external USB
>>> drive, & I edited /etc/network/interfaces to use a fixed IP address on
>>> the LAN.  But I've noticed that when I reboot it, it comes up with a
>>> DHCP address first, then changes to the fixed IP.  What have I done
>>> wrong, & how do I fix it?
>>>
>>> Thanks.
>>>
>> Remove or disable the dhcpdc package. It's a recent addition to the 
>> Rasbian images and tends to ignore the interfaces file and do its own thing.
>>
>> It's fine for the average user who uses the desktop and sets up 
>> networking via the GUI, but just gets in the way when you want to do 
>> things yourself.
>
> Thanks.  Is removing it likely to break anything?  
>
> I've never connected a keyboard, mouse, or monitor to this Pi --- I
> just used dd to put the image on the SD card, put that in the Pi,
> started it up, found it on the LAN (with a DHCP address) and used ssh
> to do the rest (obviously changing the default password first...).
> And I'd like to not have to dig out a spare keyboard (& so on) later
> if it doesn't connect according to the static LAN IP for some reason.

That will only be necessary when you make mistakes when configuring
it via /etc/network/interfaces.  Forgetting "auto eth0", typo in
address, etc.

Mistakes in setting a gateway and DNS resolver is another one.  But that
can usually be corrected without connecting monitor and keyboard.

[toc] | [prev] | [next] | [standalone]


#9015

FromAdam Funk <a24061@ducksburg.com>
Date2015-07-02 10:16 +0100
Message-ID<d4cf6cxegp.ln2@news.ducksburg.com>
In reply to#9012
On 2015-07-01, Rob wrote:

> Adam Funk <a24061@ducksburg.com> wrote:
>> On 2015-07-01, Dom wrote:

>>> Remove or disable the dhcpdc package. It's a recent addition to the 
>>> Rasbian images and tends to ignore the interfaces file and do its own thing.
>>>
>>> It's fine for the average user who uses the desktop and sets up 
>>> networking via the GUI, but just gets in the way when you want to do 
>>> things yourself.
>>
>> Thanks.  Is removing it likely to break anything?  
>>
>> I've never connected a keyboard, mouse, or monitor to this Pi --- I
>> just used dd to put the image on the SD card, put that in the Pi,
>> started it up, found it on the LAN (with a DHCP address) and used ssh
>> to do the rest (obviously changing the default password first...).
>> And I'd like to not have to dig out a spare keyboard (& so on) later
>> if it doesn't connect according to the static LAN IP for some reason.
>
> That will only be necessary when you make mistakes when configuring
> it via /etc/network/interfaces.  Forgetting "auto eth0", typo in
> address, etc.
>
> Mistakes in setting a gateway and DNS resolver is another one.  But that
> can usually be corrected without connecting monitor and keyboard.

I just remembered that if I'm at home, I can correct the contents of
files by mounting the SD card (which is just /boot now) & the USB
drive into my laptop.  So I just have to avoid the temptation to
fiddle with certain things from outside the house.


-- 
We do not debug. Our software does not coddle the weak. Bugs 
are good for building character in the user.
                              --- Klingon Programmer's Guide

[toc] | [prev] | [next] | [standalone]


#9020

FromRob <nomail@example.com>
Date2015-07-02 12:12 +0000
Message-ID<slrnmpaam2.jkq.nomail@xs8.xs4all.nl>
In reply to#9015
Adam Funk <a24061@ducksburg.com> wrote:
> On 2015-07-01, Rob wrote:
>
>> Adam Funk <a24061@ducksburg.com> wrote:
>>> On 2015-07-01, Dom wrote:
>
>>>> Remove or disable the dhcpdc package. It's a recent addition to the 
>>>> Rasbian images and tends to ignore the interfaces file and do its own thing.
>>>>
>>>> It's fine for the average user who uses the desktop and sets up 
>>>> networking via the GUI, but just gets in the way when you want to do 
>>>> things yourself.
>>>
>>> Thanks.  Is removing it likely to break anything?  
>>>
>>> I've never connected a keyboard, mouse, or monitor to this Pi --- I
>>> just used dd to put the image on the SD card, put that in the Pi,
>>> started it up, found it on the LAN (with a DHCP address) and used ssh
>>> to do the rest (obviously changing the default password first...).
>>> And I'd like to not have to dig out a spare keyboard (& so on) later
>>> if it doesn't connect according to the static LAN IP for some reason.
>>
>> That will only be necessary when you make mistakes when configuring
>> it via /etc/network/interfaces.  Forgetting "auto eth0", typo in
>> address, etc.
>>
>> Mistakes in setting a gateway and DNS resolver is another one.  But that
>> can usually be corrected without connecting monitor and keyboard.
>
> I just remembered that if I'm at home, I can correct the contents of
> files by mounting the SD card (which is just /boot now) & the USB
> drive into my laptop.  So I just have to avoid the temptation to
> fiddle with certain things from outside the house.

Yes, that is another method.  A week or two ago I had a Pi for which
I had forgotten the login password, and I fixed it that way too.

[toc] | [prev] | [next] | [standalone]


#9013

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-07-01 22:12 +0000
Message-ID<mn1ojg$43b$1@dont-email.me>
In reply to#9010
On Wed, 01 Jul 2015 21:45:00 +0100, Adam Funk wrote:

> On 2015-07-01, Dom wrote:
> 
>> On 01/07/15 13:11, Adam Funk wrote:
>>> I have a Pi using only the /boot partition on the SD card, with
>>> /boot/cmdline.txt set to mount / from a partition on the external USB
>>> drive, & I edited /etc/network/interfaces to use a fixed IP address on
>>> the LAN.  But I've noticed that when I reboot it, it comes up with a
>>> DHCP address first, then changes to the fixed IP.  What have I done
>>> wrong, & how do I fix it?
>>>
>>> Thanks.
>>>
>> Remove or disable the dhcpdc package. It's a recent addition to the
>> Rasbian images and tends to ignore the interfaces file and do its own
>> thing.
>>
>> It's fine for the average user who uses the desktop and sets up
>> networking via the GUI, but just gets in the way when you want to do
>> things yourself.
> 
> Thanks.  Is removing it likely to break anything?
>
I don't think you need to do that. 
My copy of the file /etc/network/interfaces looks like this:

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.7.101
netmask 255.255.255.0
gateway 192.168.7.1

I set this file up manually so I can ssh in via the static IP 
192.168.7.101 and it lets my RPi access the internet via my router, which 
is on 192.168.7.1   

I run a DNS server on my main system which names both the RPi and the 
router so I can refer to the RPi as 'rpi' and the router as 'hellsgate' 
from anywhere on my LAN. There's also a file /etc/network/interfaces.dhcp 
that looks like this:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

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


I don't remember where the second file came from, but it was probably set 
up automatically last time I did a clean install as part of increasing 
the SD card size. If thats what happened I'd have renamed the newly set 
up /etc/network/interfaces file to /etc/network/interfaces.dhcp to 
preserve it before dropping my copy of interfaces into /etc/network and 
rebooting the RPi to make it come up with a known static IP.

I do not have a keyboard and monitor on my RPi because I only use it via 
an SSH login.



-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#9016

FromAdam Funk <a24061@ducksburg.com>
Date2015-07-02 10:32 +0100
Message-ID<p1df6cxphp.ln2@news.ducksburg.com>
In reply to#9013
On 2015-07-01, Martin Gregorie wrote:

> On Wed, 01 Jul 2015 21:45:00 +0100, Adam Funk wrote:
>
>> On 2015-07-01, Dom wrote:
>> 
>>> On 01/07/15 13:11, Adam Funk wrote:
>>>> I have a Pi using only the /boot partition on the SD card, with
>>>> /boot/cmdline.txt set to mount / from a partition on the external USB
>>>> drive, & I edited /etc/network/interfaces to use a fixed IP address on
>>>> the LAN.  But I've noticed that when I reboot it, it comes up with a
>>>> DHCP address first, then changes to the fixed IP.  What have I done
>>>> wrong, & how do I fix it?
>>>>
>>>> Thanks.
>>>>
>>> Remove or disable the dhcpdc package. It's a recent addition to the
>>> Rasbian images and tends to ignore the interfaces file and do its own
>>> thing.
>>>
>>> It's fine for the average user who uses the desktop and sets up
>>> networking via the GUI, but just gets in the way when you want to do
>>> things yourself.
>> 
>> Thanks.  Is removing it likely to break anything?
>>
> I don't think you need to do that. 
> My copy of the file /etc/network/interfaces looks like this:
>
> auto lo
>
> iface lo inet loopback
> iface eth0 inet static
> address 192.168.7.101
> netmask 255.255.255.0
> gateway 192.168.7.1

Aha, I think the problem might be that I left too much in when editing
the file; I have these lines:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address ....
....

as well as some auto wlan0, allow-hotplug wlan0 stuff, & same again
for wlan1, which I should delete.  I guess those come in the default
configuration for people using the USB wifi dongles instead of a
cable.


-- 
Most Americans are too civilized to hang skulls from baskets, having
been headhunters, of course, only as recently as Vietnam.
                                                  --- Kinky Friedman

[toc] | [prev] | [next] | [standalone]


#9017

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2015-07-02 10:53 +0100
Message-ID<mn31nm$566$2@news.albasani.net>
In reply to#9016
On 02/07/15 10:32, Adam Funk wrote:
> On 2015-07-01, Martin Gregorie wrote:
>
>> On Wed, 01 Jul 2015 21:45:00 +0100, Adam Funk wrote:
>>
>>> On 2015-07-01, Dom wrote:
>>>
>>>> On 01/07/15 13:11, Adam Funk wrote:
>>>>> I have a Pi using only the /boot partition on the SD card, with
>>>>> /boot/cmdline.txt set to mount / from a partition on the external USB
>>>>> drive, & I edited /etc/network/interfaces to use a fixed IP address on
>>>>> the LAN.  But I've noticed that when I reboot it, it comes up with a
>>>>> DHCP address first, then changes to the fixed IP.  What have I done
>>>>> wrong, & how do I fix it?
>>>>>
>>>>> Thanks.
>>>>>
>>>> Remove or disable the dhcpdc package. It's a recent addition to the
>>>> Rasbian images and tends to ignore the interfaces file and do its own
>>>> thing.
>>>>
>>>> It's fine for the average user who uses the desktop and sets up
>>>> networking via the GUI, but just gets in the way when you want to do
>>>> things yourself.
>>>
>>> Thanks.  Is removing it likely to break anything?
>>>
>> I don't think you need to do that.
>> My copy of the file /etc/network/interfaces looks like this:
>>
>> auto lo
>>
>> iface lo inet loopback
>> iface eth0 inet static
>> address 192.168.7.101
>> netmask 255.255.255.0
>> gateway 192.168.7.1
>
> Aha, I think the problem might be that I left too much in when editing
> the file; I have these lines:
>
> auto lo
> iface lo inet loopback
>
> auto eth0
> allow-hotplug eth0
> iface eth0 inet static
> address ....
> ....
>
> as well as some auto wlan0, allow-hotplug wlan0 stuff, & same again
> for wlan1, which I should delete.  I guess those come in the default
> configuration for people using the USB wifi dongles instead of a
> cable.
>
>
My rather aged debian server has this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
  address 192.168.1.101
  netmask 255.255.255.0
  gateway 192.168.1.1
  broadcast 192.168.1.255
  network 192.168.1.0

doesn't have a gui at all



-- 
New Socialism consists essentially in being seen to have your heart in 
the right place whilst your head is in the clouds and your hand is in 
someone else's pocket.

[toc] | [prev] | [next] | [standalone]


#9022

FromAdam Funk <a24061@ducksburg.com>
Date2015-07-02 19:40 +0100
Message-ID<46dg6cxgd7.ln2@news.ducksburg.com>
In reply to#9010
On 2015-07-02, Adam Funk wrote:

> On 2015-07-02, Dom wrote:

>> Removing it will also remove a package called "raspberrypi-net-mods", 
>> which annoyingly claims that file as one of it's configuration files. If 
>> you use the "purge" option of apt-get, it will delete your 
>> /etc/network/interfaces file!
>
> Aha, I figured out how to disable it without removing the package:
> edit /etc/dhcpcd.conf (that is a difficult filename to type
> correctly!) to add these two lines:
>
> nodhcp
> nodhcp6

Oops, it turns out that doing that hoses the resolver.  I could ssh
into the pi but it couldn't contact anything else.  I also needed to
add a name_servers="..." line to /etc/resolvconf.conf and run
'resolvconv -u'.

[toc] | [prev] | [next] | [standalone]


#9024

FromRob <nomail@example.com>
Date2015-07-02 19:30 +0000
Message-ID<slrnmpb4bb.tq1.nomail@xs8.xs4all.nl>
In reply to#9022
Adam Funk <a24061@ducksburg.com> wrote:
> On 2015-07-02, Adam Funk wrote:
>
>> On 2015-07-02, Dom wrote:
>
>>> Removing it will also remove a package called "raspberrypi-net-mods", 
>>> which annoyingly claims that file as one of it's configuration files. If 
>>> you use the "purge" option of apt-get, it will delete your 
>>> /etc/network/interfaces file!
>>
>> Aha, I figured out how to disable it without removing the package:
>> edit /etc/dhcpcd.conf (that is a difficult filename to type
>> correctly!) to add these two lines:
>>
>> nodhcp
>> nodhcp6
>
> Oops, it turns out that doing that hoses the resolver.  I could ssh
> into the pi but it couldn't contact anything else.  I also needed to
> add a name_servers="..." line to /etc/resolvconf.conf and run
> 'resolvconv -u'.

You can put the nameservers in /etc/network/interfaces as well.

[toc] | [prev] | [next] | [standalone]


#9025

FromAdam Funk <a24061@ducksburg.com>
Date2015-07-02 20:56 +0100
Message-ID<ojhg6cxnt8.ln2@news.ducksburg.com>
In reply to#9024
On 2015-07-02, Rob wrote:

> Adam Funk <a24061@ducksburg.com> wrote:
>> On 2015-07-02, Adam Funk wrote:
>>
>>> On 2015-07-02, Dom wrote:
>>
>>>> Removing it will also remove a package called "raspberrypi-net-mods", 
>>>> which annoyingly claims that file as one of it's configuration files. If 
>>>> you use the "purge" option of apt-get, it will delete your 
>>>> /etc/network/interfaces file!
>>>
>>> Aha, I figured out how to disable it without removing the package:
>>> edit /etc/dhcpcd.conf (that is a difficult filename to type
>>> correctly!) to add these two lines:
>>>
>>> nodhcp
>>> nodhcp6
>>
>> Oops, it turns out that doing that hoses the resolver.  I could ssh
>> into the pi but it couldn't contact anything else.  I also needed to
>> add a name_servers="..." line to /etc/resolvconf.conf and run
>> 'resolvconv -u'.
>
> You can put the nameservers in /etc/network/interfaces as well.

I saw some stuff on the WWW to that effect, but I wasn't sure it would
work on Raspbian, & I've already made a couple of mistakes by trying
stuff that works on Ubuntu (e.g., /usr/bin/sensible-editor) without
double-checking first!


-- 
svn ci -m 'come back make, all is forgiven!' build.xml

[toc] | [prev] | [next] | [standalone]


#9031

FromDom <domafp@blueyonder.co.uk>
Date2015-07-03 06:16 +0100
Message-ID<qUolx.37640$hX5.33437@fx09.am4>
In reply to#9025
On 02/07/15 20:56, Adam Funk wrote:
> On 2015-07-02, Rob wrote:
>
>> Adam Funk <a24061@ducksburg.com> wrote:
>>> On 2015-07-02, Adam Funk wrote:
>>>
>>> Oops, it turns out that doing that hoses the resolver.  I could ssh
>>> into the pi but it couldn't contact anything else.  I also needed to
>>> add a name_servers="..." line to /etc/resolvconf.conf and run
>>> 'resolvconv -u'.
>>
>> You can put the nameservers in /etc/network/interfaces as well.
>
> I saw some stuff on the WWW to that effect, but I wasn't sure it would
> work on Raspbian,

The dns-nameservers option does work on Raspbian.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.raspberry-pi


csiph-web