You are not logged in.

#1 2013-03-19 23:45:18

Sunday87
Member
Registered: 2013-01-17
Posts: 31

[solved] prevent netcfg/netctl from always releasing dhcp lease

Hi,

when i used plain dhcpcd (systemctl enable dhcpcd@eth0) the ip address of my machine was quite stable, it re-requested the old lease on a reboot. Now i'm using netcfg-profiles (systemctl enable netcfg) and now dhcpcd will release the lease on every shutdown and thus the machine gets a new address at the next boot. How can I prevent netcfg from passing the "release" option to dhcpcd? netcfg-profiles seems only to allow for additional options and there seems to be no "norelease" option.

Greetings

[edit]Original discussion about netcfg, suggested change to netctl below.[/edit]

Last edited by Sunday87 (2013-05-30 20:55:43)

Offline

#2 2013-03-19 23:59:43

Sunday87
Member
Registered: 2013-01-17
Posts: 31

Re: [solved] prevent netcfg/netctl from always releasing dhcp lease

Problem solved:

cp /usr/lib/network/connections/ethernet /usr/lib/network/connections/myethernet

now edit /usr/lib/network/connections/myethernet and look for the function ethernet_down(). Comment out the line "dhcpcd -qk "$INTERFACE" &>/dev/null".

change connection in netcfg profile to "myethernet"

Offline

#3 2013-03-20 00:55:51

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [solved] prevent netcfg/netctl from always releasing dhcp lease

That's not a solution, it's a workaround. You're creating an orphan file on your system outside of pacman's control

That said.... netcfg will be deprecated soon in favour of netctl, which is currently in testing. I suggest you migrate to netctl, see if it exhibits the same behaviour, and submit an appropriate patch if it does.

Offline

#4 2013-05-30 20:54:46

Sunday87
Member
Registered: 2013-01-17
Posts: 31

Re: [solved] prevent netcfg/netctl from always releasing dhcp lease

I looked into netctl. It shows the same behaviour if used with dhcpcd but not with dhclient. Those commands are now in /usr/lib/network/ip (https://projects.archlinux.org/netctl.g … src/lib/ip) in the ip_unset() function and read

        case ${DHCPClient:-dhcpcd} in
          dhcpcd)
            if [[ -f "/run/dhcpcd-$Interface.pid" ]]; then
                do_debug dhcpcd -qk "$Interface" >/dev/null
            fi
          ;;
          dhclient)
            if [[ -f "/run/dhclient-$Interface.pid" ]]; then
                # Alternatively, use -r instead of -x to also release the lease
                do_debug dhclient -q -x "$Interface" -pf "/run/dhclient-$Interface.pid" >/dev/null
            fi
          ;;
        esac

the dhcpcd line could also be changed analogously

                # Alternatively, use -k instead of -x to also release the lease
                do_debug dhcpcd -qx "$Interface" >/dev/null

Unfortunatly i am not sure how to submit this suggestion as a patch, maybe someone else does. I for now have added

DHCPClient=dhclient

to my network profile.

Greetings

[edit] I have just filed this as a bug report: https://bugs.archlinux.org/task/35760 [/edit]

Last edited by Sunday87 (2013-06-11 18:28:26)

Offline

Board footer

Powered by FluxBB