1

I'm developing a JavaScript application which calls some bash scripts to change network settings. Restarting network interface takes too long (like 20 sec or more) on some networks:

ifdown eth0; ifup eth0

I wonder whether I need to always restart interface when I edit /etc/network/interfaces (change IP, netmask, gateway, set DHCP), /etc/resolv.conf (changes DNS), /etc/apt/apt.conf (proxy for apt).

Also I think about restarting DHCP client in some situations (but not sure when this would be sufficient). Could you please shed light on this issue.

  • Restarting an interface shouldn't take anywhere near this long. What takes so long? Are you getting an IP address through DHCP? What else are you doing on connection establishment? – Gilles Aug 23 '16 at 21:50
2

Most options can be changed dynamically using tools like ifconfig, route, ip, ndd, etc. so you might consider to use a different strategy: change options dynamically using other tools and save the options to the configuration file to be persistent.

Changes to /etc/resolv.conf and /etc/apt/apt.conf are immediately in effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.