Need help with network script

  • Hi guys,


    I"m writing this script to resolve my NIC card hanging upon shutdown.
    The script is executed , but it has no effect (even after reboot).
    I put this script in /sbin and add its entry in rc.local, if that matter.


    The purpose is to have my NIC to disable TSO, and GSO after it's up.


    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    Edited 2 times, last by tinh_x7 ().

    • Official Post

    You need ifup and ifdown scripts in /etc/network/ifup.d/ and /etc/network/ifdown.d/. Look at this one for starting

    omv 7.7.9-1 sandworm | 64 bit | 6.11 proxmox kernel

    plugins :: omvextrasorg 7.0.2 | kvm 7.1.8 | compose 7.6.9 | cterm 7.8.7 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • I try to get it work in one script.


    I added the entry in rc.local: /sbin/ifup-local
    According to what ryecoaaron said,if I put this script in /etc/network/if-up.d/, would it make a difference?


    What arguments am I missing?


    This script below I wrote is working but for some reason, my interface isn't online after it's resume from hibernation (S4).
    Therefore, I have to shutdown the system, and turn it back on.
    Reboot, and cold boot are fine though.


    That's why I want to implement the if and case statement in the above script.


    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    Edited 2 times, last by tinh_x7 ().

    • Official Post

    Scripts in ifup.d/ifdown.d are automatically executed when the adapter is brought up/down. In /sbin, something else needs to call it. I think this is more appropriate than using init levels or rc.local.


    Don't you always want to disable tso and gso when bringing the NICs up? Not sure why you need the if/case.

    omv 7.7.9-1 sandworm | 64 bit | 6.11 proxmox kernel

    plugins :: omvextrasorg 7.0.2 | kvm 7.1.8 | compose 7.6.9 | cterm 7.8.7 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Scripts in ifup.d/ifdown.d are automatically executed when the adapter is brought up/down. In /sbin, something else needs to call it. I think this is more appropriate than using init levels or rc.local.


    Don't you always want to disable tso and gso when bringing the NICs up? Not sure why you need the if/case.


    I do want to tso/gso disable after startup, but the second script somehow interfere with my NICs when it wake up from hibernation.
    So I think it got to do with my NIC is not online after the system startup.
    This is what happened after hibernation with the second script:
    1. System turn on
    2. NICs are not online.
    3. OMV displays a blank page with cursor on screen.



    I haven't try it without bond.


    Quote

    The first script had case $1 which is the first positional argument so the line should be "script.sh eth0 up" in rc.local


    What's the difference between this entry and my entry in rc.local: /sbin/ifup-local.sh ?



    There is another work around is to disable tso/gso from the network interface itself in /etc/network/interfaces.
    I want to stick with the script because it's more suitable.


    Code
    # The primary network interface      
        allow-hotplug eth0
        auto eth0
        iface eth0 inet static
            post-up /sbin/ethtool -K eth0 tso off
            post-up /sbin/ethtool -K eth0 gso off

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    Edited 4 times, last by tinh_x7 ().

  • My interfaces lost connection when I add this parameters in the Interfaces' options in OMV web:


    post-up ethtool -K bond0 tso off gso off


    I know I can put in the /etc/network/interfaces all.

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    Edited 2 times, last by tinh_x7 ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!