Yocto Rocko: etc/network/interfaces file missing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Yocto Rocko: etc/network/interfaces file missing

Jump to solution
11,946 Views
acompagni
Contributor II

Hello,
I have built NXP's Yocto (4.9.88 rocko) following the Yocto Project User's Guide.

My board is based on iMX6ULL EVK and it has Ethernet interface, but in /etc/network/ there is no "interfaces" file so i can't set up static IP and wifi.

How can I enable networking in yocto environment? 

Thank you very much.

Andrea

1 Solution
9,850 Views
radhikasomaiya
Senior Contributor II

Hi Andrea Compagni,

One can follow these steps to assign Static IP. Follow below commands in your Board's Console.

  •     ifconfig -a   (To check that ip address is provided or not).    
  •     udhcpc -i eth0   ( command to get ip for ethernet port 0)
  •     ifconfig -a    (to check the ip address of eth0 and Mask)
  •     route -n   OR    netstat -r    (to find gateway and Mask)

Create file named wireless.network in path "/etc/systemd/network/"  with below data.

    [match]
    Name=eth0

    [Network]
    Address=<ip address/mask>
    Gateway=<gateway address>

 Let us know if you still do not get static ip after following above steps.

Regards,

Radhika Somaiya.

View solution in original post

5 Replies
9,851 Views
radhikasomaiya
Senior Contributor II

Hi Andrea Compagni,

One can follow these steps to assign Static IP. Follow below commands in your Board's Console.

  •     ifconfig -a   (To check that ip address is provided or not).    
  •     udhcpc -i eth0   ( command to get ip for ethernet port 0)
  •     ifconfig -a    (to check the ip address of eth0 and Mask)
  •     route -n   OR    netstat -r    (to find gateway and Mask)

Create file named wireless.network in path "/etc/systemd/network/"  with below data.

    [match]
    Name=eth0

    [Network]
    Address=<ip address/mask>
    Gateway=<gateway address>

 Let us know if you still do not get static ip after following above steps.

Regards,

Radhika Somaiya.

9,850 Views
sujay1
Contributor V

Is it possible to do the same for usb configured as cdc? what changes should be made in that .network file?

0 Kudos
9,850 Views
acompagni
Contributor II

Hello, 
thank you for your answer.

I've checked, I have installed only ifupdown.

I have also included in /mylayer/recipes-core/init-ifupdown/init-ifupdown-1.0.bbappend which should modify interfaces file through /mylayer/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces, but nothing happens.

Still no /etc/network/interfaces file

If I install NetworkManager packet and I follow your suggestion this is what I get:

nmcli device show
GENERAL.DEVICE:                         eth1
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         6E:6F:A6:5B:07:8C
GENERAL.MTU:                            1500
GENERAL.STATE:                          20 (unavailable)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               off

GENERAL.DEVICE:                         can0
GENERAL.TYPE:                           can
GENERAL.HWADDR:                         
GENERAL.MTU:                            16
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.GATEWAY:                            
IP6.GATEWAY:                            

GENERAL.DEVICE:                         can1
GENERAL.TYPE:                           can
GENERAL.HWADDR:                         
GENERAL.MTU:                            16
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.GATEWAY:                            
IP6.GATEWAY:                            

GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         92:02:94:A6:2C:43
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               off
IP4.GATEWAY:                            
IP6.GATEWAY:                            

GENERAL.DEVICE:                         sit0
GENERAL.TYPE:                           iptunnel
GENERAL.HWADDR:                         (unknown)
GENERAL.MTU:                            1480
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.GATEWAY:                            
IP6.GATEWAY:                            

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:                            
IP6.ADDRESS[1]:                         ::1/128


I really can't understand...

Thank you

Andrea

0 Kudos
9,850 Views
turker
Contributor IV

That is weird. Does your network interface work when you assign ip address using ifconfig? For example:

ifconfig eth0 up

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

You could also try manually copying the interfaces file in the following link under /etc/network/ and see if it works: https://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/i...

0 Kudos
9,850 Views
turker
Contributor IV

You may have NetworkManager or connman installed instead of ifupdown. In that case you can use nmcli/nmtui or connmanctl to configure network interfaces.

0 Kudos