ifdown/ifup and friends
Oleg Goldshmidt
pub at goldshmidt.org
Wed Apr 25 17:05:51 IDT 2018
Thanks, but unfortunately, it does not work for me, and I had tried that
before posting.
I have just verified again. I started with the interface (eth3)
connected (NB: my machine is a VMware VM, which should not matter, but
might), while yours seems disconnected ("NO-CARRIER", "state DOWN").
root at hostname:~# ip addr show eth3
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:b7:20:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.50.149/24 brd 192.168.50.255 scope global eth3
root at hostname:~# ip link set down eth3
root at hostname:~# ip addr show eth3
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:b7:20:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.50.149/24 brd 192.168.50.255 scope global eth3
Then I disconnected the interface in vSphere, only to get
root at hostname:~# ip addr show eth3
5: eth3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:b7:20:8c brd ff:ff:ff:ff:ff:ff
root at hostname:~# ip link set down eth3
root at hostname:~# ip addr show eth3
5: eth3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:b7:20:8c brd ff:ff:ff:ff:ff:ff
i.e., whether the interface is connected or not does not change a thing.
Can it depend on the network driver used? I have e1000 loaded (and 8021q)...
Lior Okman <lior at okman.name> writes:
> Hi,
>
> On my current host I have the following:
>
> $ ip addr show enp4s0
> 2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
> link/ether 70:85:c2:66:5a:96 brd ff:ff:ff:ff:ff:ff
>
> Running the "set link down" command yields this:
>
> $ sudo ip link set down enp4s0
> $ ip addr show enp4s0
> 2: enp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
> link/ether 70:85:c2:66:5a:96 brd ff:ff:ff:ff:ff:ff
>
> This seems to do what you want it to. The other way works as well.
>
> $ sudo ip link set up enp4s0
> $ ip addr show enp4s0
> 2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
> link/ether 70:85:c2:66:5a:96 brd ff:ff:ff:ff:ff:ff
>
> My system is a debian SID host, except that it is using the 4.16.3 kernel.
>
> --
> Lior
--
Oleg Goldshmidt | pub at goldshmidt.org
More information about the Linux-il
mailing list