ifup/ifdown config under /etc/network/interfaces


Userlevel 1
Hello,

I known that it has a command

ifup/ipdown interface_name

to control interface up/down

Does there are same configure parameters when I config /etc/network/interfaces?

just like IOS command 'shutdown' ?

Thanks!

9 replies

Hi,

if you just want to shut an interface down without removing any config, you can run 'ip link set down'. 'no shutdown' equals to 'ip link set up'.

HTH,

Jan
Userlevel 5
As of Cumulus 3.2.1 we started to support a new parameter configured under the interface called "link-down" that would behave as you have described.

auto swp1
iface swp1
link-down yes
Userlevel 1
Thx!
I personally refrain from using ifup/down and use the ip link set command instead. Much less risk.
Userlevel 3
James, I agree for transient up/down actions, "ip link set" is better/easier while working on the switch; however if the goal is to ensure the interface stays down across reboots (persistent), Eric's answer is correct.
Not everyone is running 3.2.1. I am pointing out the risk of using such commands. It is important that Cumulus users know the risk of using ifup/down commands and to use the appropriate command for the situation.
Userlevel 1
Just tested using

link-down yes

under Cumulus 3.3 and the interface still showing UP. Does it means cannot function under Cumulus 3.3, but no error prompt when running 'ifreload -a'.

Userlevel 5
machiasiaweb wrote:

Just tested using

link-down yes

under Cumulus 3.3 and the interface still showing U...

Just tried it on my Vx device running 3.3.2 and it seems to work as expected...
cumulus@leaf01:~$ ip link show swp1
4: swp1: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 44:38:39:00:00:03 brd ff:ff:ff:ff:ff:ff

cumulus@leaf01:~$ net add interface swp1 link
autoneg : Auto negotiation
down : Disable, turn off, etc
duplex : Link duplex
fec : Forward Error Correction
speed : Link speed
cumulus@leaf01:~$ net add interface swp1 link down
cumulus@leaf01:~$ net commit
--- /etc/network/interfaces 2017-07-06 15:34:14.752445440 +0000
+++ /var/run/nclu/iface/interfaces.tmp 2017-07-06 15:34:30.816402428 +0000
@@ -6,10 +6,11 @@
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto swp1
iface swp1
+ link-down yes

net add/del commands since the last 'net commit'
================================================

User Timestamp Command
------- -------------------------- --------------------------------
cumulus 2017-07-06 15:34:28.063881 net add interface swp1 link down
cumulus 2017-07-06 15:34:30.817025 net commit

cumulus@leaf01:~$ ip link show swp1
4: swp1: mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether 44:38:39:00:00:03 brd ff:ff:ff:ff:ff:ff

Perhaps you want to run ifreload -av to see all the output for troubleshooting
cumulus@leaf01:~$ sudo ifreload -av
info: loading builtin modules from /usr/share/ifupdown2/addons
info: executing /var/lib/ifupdown2/hooks/get_reserved_vlan_range.sh
info: executing /bin/pidof -x clagd
info: executing /var/lib/ifupdown2/hooks/get_reserved_vlan_range.sh
info: executing /bin/pidof mstpd
info: executing /sbin/ip rule show
info: executing /sbin/ip -6 rule show
info: address: using default mtu 1500
info: 'link_master_slave' is set. slave admin state changes will be delayed till the masters admin state change.
info: processing interfaces file /etc/network/interfaces
info: no interfaces to down ..
info: reload: scheduling up on interfaces: ['lo', 'eth0', 'swp1']
info: lo: running ops ...
info: netlink: ip link show
info: netlink: ip addr show
info: executing /sbin/brctl show
info: lo: netlink: ip link set dev lo up
info: reading '/proc/sys/net/ipv4/conf/lo/forwarding'
info: reading '/proc/sys/net/ipv6/conf/lo/forwarding'
info: swp1: running ops ...
info: swp1: keeping link down due to user config
info: swp1: netlink: ip link set dev swp1 down
info: reading '/proc/sys/net/ipv4/conf/swp1/forwarding'
info: reading '/proc/sys/net/ipv6/conf/swp1/forwarding'
info: reading '/sys/class/net/swp1/speed'
info: reading '/sys/class/net/swp1/duplex'
info: executing ethtool swp1
info: executing ethtool -s swp1 speed 1000 duplex full
info: eth0: running ops ...
info: eth0: netlink: ip link set dev eth0 up
info: dhclient4 already running on eth0. Not restarting.
info: reading '/proc/sys/net/ipv4/conf/eth0/forwarding'
info: reading '/proc/sys/net/ipv6/conf/eth0/forwarding'
info: reading '/sys/class/net/eth0/speed'
info: reading '/sys/class/net/eth0/duplex'
info: executing ethtool eth0

Make sure you see the line above in bold.
Userlevel 1
It running fine now after upgrade to Cumulus 3.2. May be that is caused by bug in older version.

Reply