commands to make ethernet interfaces up down using ip command
I was using following commands to up
the devices
# 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
I don't have ifconfig
installed currently on a new device, but have ip
command
I can use ip addr
command to see the ip addresses of my system
what are the equivalent commands of ifconfig ... up
using command ip
ip link show
output is:
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
Solution 1:
The following example will assume that your network card's name is eth0
.
To bring up interface: ip link set eth0 up
To bring down interface: ip link set eth0 down