ifup / ifdown / ifquery

  • ifup - bring a network interface up
  • ifdown - take a network interface down
  • ifquery - parse interface configuration\

ifup, ifdown, and ifquery are shipped with Ubuntu to manage network interfaces. The interface configurations are set in /etc/network/interfaces. See also man interfaces.

The state of the interfaces is located in /run/network/interfaces. If one is up or down, but not showing in the list with ifquery or in the file, you can use –force to have it be recorded in a certain state.

For example, if you brought an interface up (or down) using another program, and ifup or ifdown don't show the same state in ifquery or the run file, set the state directly using –force.

ifup

  • -a - load configuration for all devices marked auto
  • –force - force configuration
  • -i - read configuration from file instead of /etc/network/interfaces
  • -o option:value - set option to value manually
  • -v - verbose output

ifdown

  • -a - brings down all devices configured in the interfaces file
  • –force - force configuration
  • -i - read configuration from file instead of /etc/network/interfaces
  • -o option:value - set option to value manually
  • -v - verbose output

ifquery

  • -l or –list - list all interfaces
  • –state device - dump the state of the interfaces; all if no device specified

Scenarios

If you want to force reset an interface completely, so that you can restart from scratch using the configuration in interfaces, here's how:

First, remove the IP address from the interface:

ifconfig eth0 0

Then, force the device to not be considered as up by ifup, ifdown or ifquery:

ifdown --force eth0

Finally, bring it back online using interfaces config:

ifup eth0