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

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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"

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"

--  
Regards,
Wojciech M. Zabolotny

Re: How to automatically configure eth0 interface after Raspberry Pi is switched on
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.

--  
Regards,
Wojciech M. Zabolotny

Re: How to automatically configure eth0 interface after Raspberry Pi is switched on
On 31/03/2015 20:14, wzab wrote:
Quoted text here. Click to load it
[]

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

--  
Cheers,
David
We've slightly trimmed the long signature. Click to see the full one.
Re: How to automatically configure eth0 interface after Raspberry Pi is switched on
W dniu ?roda, 1 kwietnia 2015 12:08:15 UTC+2 u?ytkownik David Tay
lor napisa?:
Quoted text here. Click to load it
  
Quoted text here. Click to load it
Raspbian is very huge. Additionally when using Buildroot compiled Linux I c
an 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 unattende
d for a long time.
--  
Regards,
Wojtek

Site Timeline