For system, network and cloud administrators

How to bring a network interface up or down with ifconfig in Linux

On some machines running Ubuntu frequently, you can easily restart (down/up state) a network interface by ultimately using the ifconfig command.

  • On Ubuntu 16.04/18.04/20.04 LTS.

So, open your terminal and let’s start.

  1. Display the current state of the interface you want to bring up or down using the ip link show command:
ip link show thenameofyournetworkinterface

and in my case, the name of the interface is enp134s0f1 and that’s the one I’ll be using in this article:

ip link show enp134s0f1

7: enp134s0f1: mtu 9134 qdisc mq master bondA portid 4rrr3334 state DOWN mode DEFAULT group default qlen 13000

The output of the ip link show command
  1. Alternatively, you can display the current state of the interface using the ip a command too:
ip a | grep -A 5 "enp134s0f1:"

7: enp134s0f1: mtu 9134 qdisc mq master bondA portid 4rrr3334 state DOWN group default qlen 13000

The output of the ip a command

From the output above, we can see the interface has a state down. To make sure the proper process is followed, we will need to also run a command with ifconfig that will put the interface enp134s0f1 down, for good.

  1. Ensure the interface is down using ifconfig:
ifconfig enp134s0f1 down
  1. Now, bring it up online:
ifconfig enp134s0f1 up
  1. Verify if the interface is now up using the ip a command:
ip a | grep -A 5 "enp134s0f1:"

7: enp134s0f1: mtu 9134 qdisc mq master bondA portid 4rrr3334 state UP group default qlen 13000

The output of the ip a command
  1. Double-check the interface is up using the ip link show command too:
ip link show enp134s0f1

7: enp134s0f1: mtu 9134 qdisc mq master bondA portid 4rrr3334 state UP mode DEFAULT group default qlen 13000

The output of the ip link show command

Leave a Reply

Your email address will not be published. Required fields are marked *