[yocto] dhcp eth0 network

Drew Moseley drew at moseleynet.net
Sat May 13 10:27:03 PDT 2017


Hi Peter,

First question, after you manually configure with ifconfig, can you actually connect to external devices on the network?  If so that implies that your driver is functioning properly and that you really only need to figure out how to configure DHCP and automatic configuration.  If no connections are possible after the manual configuration then the you likely have a driver issue.

I played with both sysvinit and systemd based configurations and it seems the automatic DHCP addressing is handled slightly differently in these environments. 

In the case of sysvinit, busybox-udhcpc client is installed and _should_ be bringing your interface up automatically. This worked out-of-the-box for me with no extra config changes needed.

In the case of systemd, there didn’t seem to be a DHCP client configured in the default configuration (for my Beaglebone and Raspberry Pi builds anyway).  I manually included the connman package in my build and the interface was automatically configured. It looks like using the networkd PACKAGECONFIG option for the systemd package may be another solution but I had mixed results with that; it may require extra config files in /etc/systemd/networkd or some such but since connman worked for me I stopped investigating.

I’m not sure that’s the best answer and I’d love to hear if there is a cleaner solution for getting a DHCP client in a systemd-based configuration but it may work to at least get you up and running.  Of course this solution requires a rebuild of your target image.  If your image truly does not have a DHCP client installed then you may have to rebuild.

HTH,

Drew

> On May 13, 2017, at 5:25 AM, Peter Balazovic <balazovic.peter at gmail.com> wrote:
> 
> Hello,
> 
> Unfortunately I have no knowledge about that how image is built :(  I got just that image downloaded which is already built. 
> 
> BUT after applying ifconfig I got network working and connection established... Now I wanna do it permanetly and dhcp instead of static IP.
> 
> root at imx6qpsabreauto:~# ifconfig eth0 10.171.88.8 netmask 255.0.0.0 up
> root at imx6qpsabreauto:~# ifconfig
> eth0      Link encap:Ethernet  HWaddr ee:d2:50:0d:f3:33
>           inet addr:10.171.88.8  Bcast:10.255.255.255  Mask:255.0.0.0
>           inet6 addr: fe80::ecd2:50ff:fe0d:f333/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:4447 errors:0 dropped:951 overruns:0 frame:0
>           TX packets:254 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:640741 (625.7 KiB)  TX bytes:37067 (36.1 KiB)
> 
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           inet6 addr: ::1/128 Scope:Host
>           UP LOOPBACK RUNNING  MTU:65536  Metric:1
>           RX packets:2000 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:2000 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:152000 (148.4 KiB)  TX bytes:152000 (148.4 KiB)
> 
> root at imx6qpsabreauto:~#
> 
> within /etc/network directory
> 
> root at imx6qpsabreauto:/etc/network# ls
> if-down.d  if-post-down.d  if-pre-up.d  if-up.d  interfaces
> root at imx6qpsabreauto:/etc/network# vi interfaces
> 
> auto lo
> iface lo inet loopback
> 
> auto eth0
> iface eth0 inet dhcp
> ~
> ~
> ~
> 
> 
> 
> After reset I need to set network again and static ...
> 
> cheers,
> Peter
> 
> 
> 
> On Fri, May 12, 2017 at 9:55 PM, Trevor Woerner <twoerner at gmail.com <mailto:twoerner at gmail.com>> wrote:
> Hi Peter,
> 
> There isn't enough information here for me to help you.
> 
> Could you please list the commands and steps you used to build the image?
> - what repositories are you using?
> - what branches of those repositories?
> - if you changed any config files, what did you change?
> - what command did you run to build your image?
> - what did bitbake print as your build configuration?
> 
> Which i.mx <http://i.mx/> board are you using? There are dozens of them.
> 
> Best regards,
>     Trevor
> 
> 
> On Fri, May 12, 2017 at 3:34 PM, peter at gmail.com <mailto:peter at gmail.com>
> <balazovic.peter at gmail.com <mailto:balazovic.peter at gmail.com>> wrote:
> > I build on i.mx <http://i.mx/> (NXP) machine, I want to get configured as dhcp  (no
> > static)...
> >
> >
> > ------ Original Message ------
> > From: "Trevor Woerner" <twoerner at gmail.com <mailto:twoerner at gmail.com>>
> > To: "Peter Balazovic" <balazovic.peter at gmail.com <mailto:balazovic.peter at gmail.com>>
> > Cc: "Yocto list discussion" <yocto at yoctoproject.org <mailto:yocto at yoctoproject.org>>
> > Sent: 5/12/2017 9:32:17 PM
> > Subject: Re: [yocto] dhcp eth0 network
> >
> >> Hi Peter,
> >>
> >> For what MACHINE are you building? What's your target hardware? Can
> >> you summarize the steps you took to build your image?
> >>
> >> What do you want eth0 to do? dhcp or static ip?
> >>
> >> Best regards,
> >>     Trevor
> >>
> >>
> >> On Fri, May 12, 2017 at 12:01 PM, Peter Balazovic
> >> <balazovic.peter at gmail.com <mailto:balazovic.peter at gmail.com>> wrote:
> >>>
> >>>  Dears,
> >>>
> >>>  I got Yocto image and unfortunatelly network is not somehow enabled &
> >>>  proprely configured. After "ifconfig" no eth0 configured.
> >>>
> >>>
> >>>>  ifconfig
> >>>
> >>>  lo    Link encap:Local Loopback
> >>>         inet addr:127.0.0.1 Mask:255.0.0.0
> >>>   ....
> >>>
> >>>
> >>>
> >>>>  /etc/network
> >>>>  ls
> >>>
> >>>  if-down.d if-post-down.d if-pre-up.d  if-up.d
> >>>
> >>>
> >>>  How should I setup "eth0" to get network working properly?
> >>>
> >>>  Thanks.
> >>>
> >>>
> >>>
> >>>  --
> >>>  _______________________________________________
> >>>  yocto mailing list
> >>>  yocto at yoctoproject.org <mailto:yocto at yoctoproject.org>
> >>>  https://lists.yoctoproject.org/listinfo/yocto <https://lists.yoctoproject.org/listinfo/yocto>
> >>>
> >
> 
> -- 
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170513/558103c0/attachment.html>


More information about the yocto mailing list