Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to automatically configure eth0 interface after Raspberry Pi is switched on

934 views
Skip to first unread message

wzab

unread,
Mar 31, 2015, 3:14:19 PM3/31/15
to
Hi,

In my Raspberry Pi based systems using the Buildroot built Linux image
I always had problems with eth0 not being correctly configured after
switching on.
Even if I configured it in the /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

Or when I called the "udhcpc eth0" from the init scripts.

The reason was, that the USB subsystem was not initialized yet,
when the init scripts were executed.

I finally solved the problem using the udev, to configured eth0 as soon
as it gets visible.
If somebody wants to configure eth0 via DHCP, it may be enough to add
the following to the /etc/udev/rules.d/60-rpi-eth.rules rule:

KERNEL=="eth*", SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/udhcpc $env{INTERFACE}"

If somebody wants to configure the eth0 according to definitions
stored in /etc/network/interfaces, then the appropriate
/etc/udev/rules.d/60-rpi-eth.rules rule file is:

KERNEL=="eth*", SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE}"

--
Regards,
Wojciech M. Zabolotny

Wojciech M. Zabolotny

unread,
Mar 31, 2015, 4:11:42 PM3/31/15
to
Hi,

If "udev" is too big for your system, and you decide to use "mdev" to
dynamically manage devices, the working solution is to add:


#network interface
(eth.*) root:netdev 660 >net/%1 @/sbin/ifup $INTERFACE

at the end of the /etc/mdev.conf file.

David Taylor

unread,
Apr 1, 2015, 6:08:15 AM4/1/15
to
On 31/03/2015 20:14, wzab wrote:
> Hi,
>
> In my Raspberry Pi based systems using the Buildroot built Linux image
> I always had problems with eth0 not being correctly configured after
> switching on.
[]

Why not download and use Raspbian? I haven't been aware of the problem
using the downloadable versions.

--
Cheers,
David
Web: http://www.satsignal.eu

wzab

unread,
Apr 1, 2015, 2:10:16 PM4/1/15
to
W dniu środa, 1 kwietnia 2015 12:08:15 UTC+2 użytkownik David Taylor napisał:
> On 31/03/2015 20:14, wzab wrote:
> > Hi,
> >
> > In my Raspberry Pi based systems using the Buildroot built Linux image
> > I always had problems with eth0 not being correctly configured after
> > switching on.
> []
>
> Why not download and use Raspbian? I haven't been aware of the problem
> using the downloadable versions.
>
Raspbian is very huge. Additionally when using Buildroot compiled Linux I can run it from initramfs so it:
1) does not wear my SD card
2) it is fully resistant to random power cuts
Both features are very good for a system which is supposed to run unattended for a long time.
--
Regards,
Wojtek

David Taylor

unread,
Apr 2, 2015, 3:15:13 AM4/2/15
to
On 01/04/2015 19:10, wzab wrote:
[]
> Raspbian is very huge. Additionally when using Buildroot compiled Linux I can run it from initramfs so it:
> 1) does not wear my SD card
> 2) it is fully resistant to random power cuts
> Both features are very good for a system which is supposed to run unattended for a long time.

Whilst I don't see size as a significant problem these days, I can
appreciate that both the advantages you cite are genuine benefits.
Perhaps one day Raspbian will support initramfs as well.

Thanks for the update.

gregor herrmann

unread,
Apr 2, 2015, 7:50:09 PM4/2/15
to
On Thu, 02 Apr 2015 08:15:12 +0100, David Taylor wrote:

> Perhaps one day Raspbian will support initramfs as well.

it does if you use a raspbian kernel instead of the foundation kernel
that the foundation bolts onto the raspian image they create.

gregor
--
.''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Treibhaus: Yellowman Jamaica
0 new messages