1

I did some testing below. It seems ifdown ens32 didn't bring the interface down. And ip link still show UP. Only ip link set ens32 down brings the interface down. So what's the problem here? Why ifdown can't bring down the interface?

root:[~]# cat /etc/*release*
Oracle Linux Server release 7.6
NAME="Oracle Linux Server"
VERSION="7.6"
ID="ol"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.6"
PRETTY_NAME="Oracle Linux Server 7.6"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:6:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.6
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.6
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Oracle Linux Server release 7.6
cpe:/o:oracle:linux:7:6:server
root:[~]# 
root:[~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:31:a8:12 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
root:[~]# ifdown ens32
Device 'ens32' successfully disconnected.
root:[~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:31:a8:12 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
root:[~]# ip link set ens32 down
root:[~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:50:56:31:a8:12 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:33:cf:a3 brd ff:ff:ff:ff:ff:ff
root:[~]# 
4

It's not true that there's no difference.

ifup and ifdown read /etc/network/interfaces, and on top of bringing the interfaces up and down, they execute lots of scripts also in /etc/network, which provides hooks for various things (like DHCP).

On the other hand, ip link ... (new variant) and ifconfig ... up/down (old variant) set the state of the interface directly, not doing any of the additional actions that may be necessary if an interface goes up and down.

So if ifdown doesn't work, your system is probably not configured to use the classic /etc/network/interfaces system (for example, because it uses systemd, which does everything differently), or there's an error somewhere in some script that's excute first, or possibly some other reason.

2
  • 3
    Mostly correct, except this is Oracle Linux, which is a RHEL clone, so instead of /etc/network/ its files in /etc/sysconfig/network-scripts/. /etc/network/interfaces is a Debianism.
    – jsbillings
    Aug 10 '19 at 16:24
  • 2
    Also, depending on whether NM_CONTROLLED=yes or not, ifup/ifdown will use NetworkManager to bring up/down interfaces, which has a whole collection of additional actions it’ll perform. NetworkManager is enabled by default on el7.
    – jsbillings
    Aug 10 '19 at 16:28
-2

There is no difference between the new ip commands (the new way to do things) and the old ones - there used to be ipconfig, netstat, arp and route. See here for a comparison:

https://p5r.uk/blog/2010/ifconfig-ip-comparison.html

https://www.tecmint.com/ifconfig-vs-ip-command-comparing-network-configuration/

However, ifup and ifdown are part of network scripts doing more than each single command listed above. Perhaps your network is managed by wicked or a different network manager. Try

rpm -qf `/sbin/ifdown`

to see whether perhaps ifdown is part of some network management package - this varies across distributions.

So maybe you need to change the way your network is managed by your network config tool.

4
  • Does iprouter2 include netstat functionality Aug 10 '19 at 13:02
  • @炸鱼薯条德里克 The replacement for netstat in the new ip System is called ss.
    – Ned64
    Aug 10 '19 at 13:08
  • Note that this is true for ifconfig vs. ip, but not for ifup and ifdown.
    – dirkt
    Aug 10 '19 at 13:44
  • @dirkt Thanks, I corrected by mistake!
    – Ned64
    Aug 10 '19 at 19:36

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.