This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4379: Static IP for Linux 4.19

Part Number: AM4379

Hi,
The original question 's solution did not work for me, i am using latest linux-rt kernel for am437x.
I want to set a static ip for my eth0(cpsw) and eth1(pru), and want to call a service as soon as both eth0 and eth1 ports goes up(or boot completion), how can i manage that?

Thanks!

  • Hello ccanberry,

    Post Lost network config when cable is disconnected has some additional ideas you can try.

    Regards,

    Nick

  • Hi Nick,

    Because the solution in the post   caused a bad unit file setting error, and failed after a couple of tries, i gave up and proceed with Schuyler's answer using systemD.

    In the link, it is not stated clearly that creating 01-eth-static.network file is enough, or one must create it over the steps done in Yordan's solution, in my case i tried both ways, my aim is to fix eth0 and eth1 a static-ip, i first tried for eth0:

    1. In interfaces file, i commented out the following part(also tried without commenting them out):

    # Wired or wireless interfaces
    #auto eth0
    #iface eth0 inet dhcp
    # pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /proc/cmdline > /dev/null
    # udhcpc_opts -R -b

    2. I did not change /lib/systemd/system/systemd-networkd.service

    3. /lib/systemd/network/80-container-host0.network file is edited as below (also tired without editing):

    [Match]
    Virtualization=container
    Name=host0

    [Network]
    #DHCP=yes
    LinkLocalAddressing=yes
    LLDP=yes
    EmitLLDP=customer-bridge

    #[DHCP]
    #UseTimezone=yes

    4. I created a 01-eth-static.network under etc/systemd/network where another files 10-eth.network and 15-eth.network also exist.
    I gave it a try, but it could not get initialized, and won't give me a static-ip.

    5.I removed the other .network files under etc/systemd/network, created 10-eth-static.network file, again no eth devices up and were assigned any ip.


    However the u-boot:
    setenv ip_method manual
    setenv ipaddr 192.168.1.10
    saveenv

    solved the problem for eth0, however i need to give static-ip for both eth0 and eth1.


    Thanks!


  • Hi again,

    Could you please inform me that why creating a 10-eth-static.network (described in above steps) wouldn't set-up a static ip for me?
    Seems like i applied the solution properly...

    Thanks!

  • Hello,

    Apologies for the delayed response. Hmm, there may be a way to set up multiple static IP addresses from the uboot environment variables, but I do not know how to do it off the top of my head. Not sure if the internet has any useful ideas there.

    I don't see a 80-container-host-network file in the example /etc/systemd/network/ folders in the default AM437x RT Linux 6.3 filesystem build. Let's not follow that thread for right now.

    On Schuyler's SystemD suggestion (your 4. & 5.)

    * I would expect that you would need to have two separate eth-static.network files, one for each interface

    * I would expect you need to delete the eth.network files that setup WLAN

    * Make sure that each ethernet port has a unique subnet (e.g., 192.168.33.31 and 192.168.33.32 would NOT work. but 192.168.33.31 and 192.168.34.32 would be ok)

    If things are still not working, feel free to attach the two eth-static.network files.

    Regards,

    Nick