Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I restart a network interface? I have a vm that doesn't update its IP address correctly when switching between home and work. The vm runs Ubuntu server and uses a bridged network adapter.

share|improve this question
Under what OS/distribution? How is the network configured in the VM? – Gilles Jul 13 '12 at 23:56

Use ifdown to turn it off and ifup to turn it back on. To restart eth0:

> ifdown eth0
> ifup eth0

You will need root privileges.

More details about ifup and ifdown.

share|improve this answer

Sounds like you've got that interface configured using DHCP. If so, you want to kill the existing DHCP client, and restart it. For a lot of distros, you'd do this:

dhcpcd -k eth0
dhcpcd -d eth0

but not every distro used dhcpcd. I know some use dhclient, and doesn't Debian use pump?

Also, "eth0" may not constitute the correct interface name: do ifconfig -a to see what that VM has.

share|improve this answer
(Not about downvote:) I'm on Debian, dhcpcd and pump are in the repositories. Confusingly, dhclient is not, and that's the tool I got on installation and been using since. – Emanuel Berg Jul 14 '12 at 13:46

Under Debian, you can tell an interface to get another DHCP lease with

dhclient -v {interface_name}

The -v means "verbose" and will show you the process in action.

@JustinY's answer will work (ifup and ifdown commands) if the interfaces are configured to pull addresses from DHCP. If they are configured as static, they'll just revert to their static IPs. dhclient will attempt to contact a DHCP server no matter what.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.