树莓派mate系统设置静态IP

  • 用ifconfig在终端查看系统的设备的网卡
ifconfig

显示如下

enp3s0    Link encap:Ethernet  HWaddr 8c:16:45:44:21:6a  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

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:110752 errors:0 dropped:0 overruns:0 frame:0
          TX packets:110752 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:308244032 (308.2 MB)  TX bytes:308244032 (308.2 MB)

wlp2s0    Link encap:Ethernet  HWaddr 0c:54:15:80:8a:9a  
          inet addr:30.117.28.26  Bcast:30.117.31.255  Mask:255.255.248.0
          inet6 addr: fe80::66a6:8e8f:9d92:1d40/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6864140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2573388 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3301132822 (3.3 GB)  TX bytes:645833957 (645.8 MB)
  • 树莓派内部设置静态IP
sudo nano /etc/network/interfaces

比如我要设置有线端口为静态IP,则添加如下:

auto enp3s0
iface enp3s0 inet static
address 192.168.1.101
netmask 24

按Ctrl+X退出,选择Y保存,Enter结束。

你可能感兴趣的:(linux)