- Linux Administration Cookbook
- Adam K. Dean
- 143字
- 2021-07-02 14:24:29
Shutting down and bringing up an interface administratively
To work with the interface itself, we need to use another element of the ip suite, this being ip link. Note again the use of sudo:
$ sudo ip link set eth1 down
Checking our interfaces, we can see that the interface is in the DOWN state:
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 08:00:27:0d:d9:0c brd ff:ff:ff:ff:ff:ff
inet 192.168.33.10/24 brd 192.168.33.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
You will find yourself unable to ping this host from centos2.
To bring an interface back up, simply run the following:
$ sudo ip link set eth1 up
Note that if you add another IP to an interface on a temporary basis before bringing an interface down and up, your temporary additional IP will not be remembered.