使用ip命令降低以太网接口的命令

分享于 

2分钟阅读

互联网

  繁體

问题:

我正使用以下命令来up设备


# ifconfig p1p1:1 10.250.0.0 netmask 255.255.0.0 up


# ifconfig p1p1:2 10.251.0.0 netmask 255.255.0.0 up


# ifconfig p1p1:3 10.252.0.0 netmask 255.255.0.0 up



我没有在新设备上安装ifconfig,但有ip命令

可以使用ip addr命令查看系统的ip地址

ip link show输出为:


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1


 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00


2: p1p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000


 link/ether 00:ba:e7:ae:ed:3e brd ff:ff:ff:ff:ff:ff


3: p1p2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000


 link/ether 00:ba:e7:ae:ed:3f brd ff:ff:ff:ff:ff:ff


4: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000


 link/ether 60:aa:3e:25:47:1f brd ff:ff:ff:ff:ff:ff


5: em2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000


 link/ether 60:aa:3e:25:47:2f brd ff:ff:ff:ff:ff:ff




答案1:

以下示例假定你的网卡名称为eth0

要打开接口:ip link set eth0 up

要关闭接口:ip link set eth0 down



COM  INT  COMM  Comma  MAKE  接口