打开terminal(用Ctrl+Alt+T打开)
1. 输入ifconfig
打印如下:
enp1s0 Link encap:Ethernet HWaddr 6c:4b:90:0b:53:be
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::1fbf:55e3:1c4c:c79d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:144897 errors:0 dropped:630 overruns:0 frame:0
TX packets:13548 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13441598 (13.4 MB) TX bytes:1943215 (1.9 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:7441 errors:0 dropped:0 overruns:0 frame:0
TX packets:7441 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:727906 (727.9 KB) TX bytes:727906 (727.9 KB)
wlp2s0 Link encap:Ethernet HWaddr 34:f6:4b:8e:8e:83
inet addr:192.168.17.208 Bcast:192.168.17.255 Mask:255.255.255.0
inet6 addr: fe80::7b1:7fd6:cdbc:29a0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:39311 errors:0 dropped:0 overruns:0 frame:0
TX packets:34360 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19874047 (19.8 MB) TX bytes:6833538 (6.8 MB)
2.开始设置IP,网关等
sudo
vi
/etc/network/interfaces
#静态设置IP地址
auto lo
iface lo inet loopback
auto enp1s0
iface enp1s0 inet static
address 192.168.12.89(换成你的IP地址)
netmask 255.255.255.0
gateway 192.168.12.1(换成你的网关)
#自动获得IP地址
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
3.重新启动网卡
sudo
/etc/init
.d
/networking
restart
完成