Menu

static ip on initrd.img

2020-10-12
2021-02-09
  • superelmotion

    superelmotion - 2020-10-12

    I use iPXE with a static ip and not dhcp to load clonezilla via http. The live-boot ip parameter is as follows:

    ip=eth0:${net0/ip}:${net0/netmask}:${net0/gateway}:${net0/dns}

    The ip-parameter is transfered to the initrd but it works not as expected. The initrd runs into DHCP-requesting. If I assign the IP manually via ifconfig it is possible to load/fetch the filesystem.squashfs by a wget call.

    So, how can I force the initrd to use a static ip instead of DHCP?

     
  • Steven Shiau

    Steven Shiau - 2020-10-19

    Which version of Clonezilla live did you use? Could you please share the whole boot parameter so that we can try it here to reproduce this issue?
    Thanks.

    Steven

     
  • superelmotion

    superelmotion - 2020-10-19

    Hey Steven,

    thanks for your reply and investigation!!

    I have tried several versions: 2.6.7/2.6.5/2.5.3 and even ubuntu based versions. Always the same problem. Here my boot parameters:

    ``
    **#!ipxe
    ifopen net0
    set net0/ip x.x.x.x
    set net0/netmask 255.255.255.0
    set net0/gateway x.x.x.x

    set server-ip x.x.x.x
    set base-url http://${server-ip}

    kernel ${base-url}/clonezilla-2.6.5/vmlinuz initrd=initrd.img boot=live ip=eth0:${net0/ip}:${net0/netmask}:${net0/gateway}:8.8.8.8 username=user union=overlay live-config debug=1 components noswap edd=on nodmraid locales=de_DE.utf8 keyboard-layouts=de ocs_prerun="wget ${base-url}/netinstall/install.py" ocs_live_run="/usr/bin/python3 /root/install.py ${server-ip}" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=${base-url}/clonezilla-2.6.5/filesystem.squashfs ocs_sshd_port=22 ocs_daemonon="ssh"
    initrd ${base-url}/clonezilla-2.6.5/initrd.img
    boot
    ``
    Do you have an idea what is going wrong? For my understanding all parameters are correct and it should work as described in man-pages and so on . If I enable DHCP everything is fine, but unfortunately we have to get rid of DHCP.

    Best regards and thanks a lot for your work!!

     
  • Steven Shiau

    Steven Shiau - 2020-10-20

    Because the parameter "fetch" will trigger netboot in live-boot, hence it switches to DHCP client.
    You can check the file /lib/live/boot/9990-networking.sh in the initrd and you will realize that.
    To assign static IP address using "ip=" parameter only works for boot media like CD or USB stick, not PXE.
    So, you have to modify live-boot to achieve your goal...

    Steven

     
  • Steven Shiau

    Steven Shiau - 2020-10-21

    If you haven't found the solution, I have an improved 9990-netboot.sh which should work for you. Here you are:

    1. Download clonezilla-live-2.6.7-28-amd64.zip
    2. unzip clonezilla-live-2.6.7-28-amd64.zip -d zip
    3. cd zip/live/; mkdir initrd; cd initrd
    4. xzcat ../initrd.img | cpio -idmv
    5. wget -O lib/live/boot/9990-netboot.sh https://stevenshiau.org/clonezilla-live/9990-netboot.sh
    6. find . | cpio --quiet -o -H newc | xz -c -9 --check=crc32 > ../initrd.img
    7. Put the created ../initrd.img to your iPXE (http) server

    In the PXE server, you should add "nodhcp" to the boot parameter. Then the whole is like:
    kernel ${base-url}/clonezilla-2.6.7-28/vmlinuz boot=live ip=eth0:${net0/ip}:${net0/netmask}:${net0/gateway}:8.8.8.8 username=user union=overlay live-config components noswap edd=on nodmraid locales=en_US.utf8 keyboard-layouts=en ocs_live_run="/bin/bash" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=${base-url}/clonezilla-2.6.7-28/filesystem.squashfs ocs_sshd_port=22 ocs_daemonon="ssh" nodhcp

    If this works well, I will send the patch file to the live-boot upstream.

    Steven

     

    Last edit: Steven Shiau 2020-10-21
  • superelmotion

    superelmotion - 2020-10-21

    Looks promising, thanks a lot for your work. I will try it and give feedback afterwards.

     
  • superelmotion

    superelmotion - 2020-10-21

    I tried your patch and it works like a charm. Thank you very much. I would appreciate if you could send the patch file to the live-boot upstream.

    Best regards
    Carsten

     
  • Steven Shiau

    Steven Shiau - 2020-10-23

    Sure. At the moment, I have created a branch here:
    https://salsa.debian.org/stevenshiau-guest/live-boot/-/commit/a2a3ce02b2089abee2765bb3c61ddf49d8cf2db0
    still waiting for the upstream to approve my previous merge requests (MR). Once they are done, I will submit this branch for another MR.
    Before the upstream accepts all our MR, I have used them in the live-boot (1:20201022-drbl1) for Clonezilla live. Hence you can give testing Clonezilla live 2.7.0-5 or 20201022-* a try:
    https://clonezilla.org/downloads.php
    They are now ready for you to use iPXE to netboot while assigning an static IP address, no need to have a DHCP server.
    Please let us know the results after you test them. Thanks.

    Steven

     
  • Steven Shiau

    Steven Shiau - 2021-02-09

    OK, the upstream has accepted my previous MR (#35), so I have opened another MR here:
    https://salsa.debian.org/live-team/live-boot/-/merge_requests/36

    Steven

     

    Last edit: Steven Shiau 2021-02-09

Log in to post a comment.

MongoDB Logo MongoDB