- View all network interfaces
1
2
3
4
5
6
7
8
9
10
11
12
13
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:bf:70:9b brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
valid_lft 86081sec preferred_lft 86081sec
inet6 fe80::808d:99cf:a72:469b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
- Disable network interface
1
$ sudo ip link set enp0s3 down
- View network interface status
1
2
3
4
5
6
7
8
9
10
11
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 08:00:27:bf:70:9b brd ff:ff:ff:ff:ff:ff
- Enable network interface
1
$ sudo ip link set enp0s3 up
- Disable interface and use DHCP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ sudo ip link set enp0s3 down
$ sudo /sbin/dhclient -v enp0s3
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp0s3/08:00:27:bf:70:9b
Sending on LPF/enp0s3/08:00:27:bf:70:9b
Sending on Socket/fallback
DHCPREQUEST for 10.0.2.15 on enp0s3 to 255.255.255.255 port 67 (xid=0x45576bb1)
DHCPACK of 10.0.2.15 from 10.0.2.2 (xid=0xb16b5745)
RTNETLINK answers: File exists
bound to 10.0.2.15 -- renewal in 39792 seconds.