$ ifconfig -a
ens33: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:**:**:**:**:** txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1876 bytes 114200 (114.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1876 bytes 114200 (114.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:0c:29:f8:f7:47 brd ff:ff:ff:ff:ff:ff
$ ifup ens33
Unknown interface ens33
$ sudo vim /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
iface ens33 inet dhcp ###===>you need to add your Ethernet interface
$ sudo ifup ens33
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/ens33/00:0c:29:65:1e:42
Sending on LPF/ens33/00:0c:29:65:1e:42
Sending on Socket/fallback
DHCPDISCOVER on ens33 to 255.255.255.255 port 67 interval 3 (xid=0x7028e50f)
DHCPREQUEST of 192.168.15.142 on ens33 to 255.255.255.255 port 67 (xid=0xfe52870)
DHCPOFFER of 192.168.15.142 from 192.168.15.1
DHCPACK of 192.168.15.142 from 192.168.15.1
bound to 192.168.15.142 -- renewal in 3439 seconds.
$ ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=7.96 ms
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=2 ttl=55 time=9.45 ms
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=3 ttl=55 time=7.12 ms
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 7.129/8.183/9.454/0.961 ms