Skip to contentSkip to conversation

Assign IP address at boot time

DISCUSSION jchludzinski 4 participants 12 messages Mar 9, 2021 – Mar 12, 2021

lore
Share & tools
lore
#0 lore raw

Where do I assign a static IP address to my sole network interface?

I tried using the Linux boot parameters (in extlinux.conf):

LABEL Arria10 SOCDK SDMMC
KERNEL ../zImage
FDT ../socfpga_arria10_phead.dtb
APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk
console=ttyS0,115200n8 ip=192.168.0.101:255.255.255.0:eth0

Then I tried editing: /etc/network/interfaces

iface eth0 inet static address 192.168.0.101
netmask 255.255.255.0

Both failed. Where do I go?

#1 lore raw

Hi there,

Quoted 2 lines · jchludzinski via lists.yoctoproject.org

Where do I assign a static IP address to my sole network interface?

That depends on whether or not you are using a network manager and if so which one.

You haven't told us much about your board and it's network interfaces and how you built your system.

Quoted 11 lines

I tried using the Linux boot parameters (in extlinux.conf):

*LABEL Arria10 SOCDK SDMMC*
*    KERNEL ../zImage*
*    FDT ../socfpga_arria10_phead.dtb*
*    APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk console=ttyS0,115200n8 ip=192.168.0.101:255.255.255.0:eth0* Then I tried editing: /etc/network/interfaces
*iface eth0 inet static *
*address 192.168.0.101*
*netmask 255.255.255.0*
Both failed. Where do I go?

To start, do you have the driver required for your network interface? You can use ifconfig -a to see if your network interface is detected by the kernel. You should also look at the kernel log if the network interface is configured.

:rjs

Quoted 3 lines
Signature · 3 lines
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700
#2 lore raw
Quoted 1 line

To start, do you have the driver required for your network interface?

Yes, the network/Ethernet device is recognized by Linux and the appropriate driver is loaded. If I use:

$ ip add add 192.168.9.101/24 dev eth0

I’m up and running. But I want the IP assignment to happen during boot time.

#3 lore raw
Quoted 7 lines · jchludzinski
Quoted 1 line

To start, do you have the driver required for your network interface?

Yes, the network/Ethernet device is recognized by Linux and the appropriate driver is loaded. If I use:

$ ip add add 192.168.9.101/24 dev eth0

I’m up and running. But I want the IP assignment to happen during boot time.

What is your startup manager? systemd or SysVInit?

Signature · 3 lines
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700
#4 lore raw
Quoted 2 lines

What is your startup manager? systemd or SysVInit?

systemd

#5 lore raw

Create the file /etc/systemd/network/eth0.conf:

[Match]
Name=eth0
[Network]
Address=<ip>
Gateway=<ip>
DNS=<ip>

Restart systemd-networkd

# systemctl restart systemd-networkd

or reboot.

:rjs

Quoted 4 lines · jchludzinski
Quoted 2 lines

What is your startup manager? systemd or SysVInit?

systemd

Signature · 3 lines
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700
#6 lore raw
Quoted 8 lines

Create the file /etc/systemd/network/eth0.conf:

[Match]
Name=eth0
[Network]
Address=<ip>
Gateway=<ip>
DNS=<ip>

That didn't work BUT editing /lib/systemd/network/80-wired.network

[Match]
Name=en* eth*
KernelCommandLine=!nfsroot

[Match]
Name=eth0
[Network]
Address=192.168.0.101/24
#Gateway=<ip>
#DNS=<ip>

[Network]
DHCP=no

[DHCP]
#RouteMetric=10
#ClientIdentifier=mac

... did work, after: root@arria10:~# _systemctl restart systemd-networkd_

#7 lore raw
Quoted 21 lines · jchludzinski
Quoted 8 lines

Create the file /etc/systemd/network/eth0.conf:

[Match]
Name=eth0
[Network]
Address=<ip>
Gateway=<ip>
DNS=<ip>

That didn't work BUT editing /lib/systemd/network/80-wired.network [Match]
Name=en* eth*
KernelCommandLine=!nfsroot

[Match]
Name=eth0
[Network]
Address=192.168.0.101/24
#Gateway=<ip>
#DNS=<ip>

Quoted 8 lines

[Network]
DHCP=no

[DHCP]
#RouteMetric=10
#ClientIdentifier=mac
... did work, after:
*root@arria10:~#* /systemctl restart systemd-networkd/

Preferred method for local configuration is using /etc/systemd/network. However, the probable reason why it did not work is that the file should be eth0.network. The name of the file(s) do not matter that much. The extension does though.

Signature · 3 lines
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700
#8 lore raw

Can this be done using boot parameters?

Something like(?):

LABEL Arria10 SOCDK SDMMC
KERNEL ../zImage
FDT ../socfpga_arria10_phead.dtb
APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk
console=ttyS0,115200n8 ip=192.168.0.101:255.255.255.0:eth0

#9 lore raw
Quoted 1 line · jchludzinski

Can this be done using boot parameters?

Not that I know of. Why anyway?

Quoted 7 lines

Something like(?):

LABEL Arria10 SOCDK SDMMC
    KERNEL ../zImage
    FDT ../socfpga_arria10_phead.dtb
    APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk console=ttyS0,115200n8 *ip=192.168.0.101:255.255.255.0:eth0*

Signature · 3 lines
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700
#10 lore raw
In reply to jchludzinski

Try adding the following line to the match section of the 80-wired.network file. KernelCommandLine=!ip

Regards,
Chen Qi

Quoted 13 lines · jchludzinski via lists.yoctoproject.org

Can this be done using boot parameters?

Something like(?):

LABEL Arria10 SOCDK SDMMC
KERNEL ../zImage
FDT ../socfpga_arria10_phead.dtb
APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk
console=ttyS0,115200n8 *ip=192.168.0.101:255.255.255.0:eth0*

#11 lore raw
In reply to jchludzinski

Hello,

Maybe you can stop in the U-Boot monitor, and check your environment? =>
=> print serverip
=> print ipaddr
=> print gatewayip
=> print gw_ip

And see what and how your bootcmd and similar env variables look like?

And if you do not have defined above, to add them (according to ash script) and try booting again?

Zee
_______

Quoted 20 lines · jchludzinski via lists.yoctoproject.org

Where do I assign a static IP address to my sole network interface?

I tried using the Linux boot parameters (in extlinux.conf):

LABEL Arria10 SOCDK SDMMC

    KERNEL ../zImage
    FDT ../socfpga_arria10_phead.dtb
    APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk console=ttyS0,115200n8 ip=192.168.0.101:255.255.255.0:eth0

Then I tried editing: /etc/network/interfaces

iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0

Both failed. Where do I go?