1. 程式人生 > 實用技巧 >Deepin 設定靜態 ip

Deepin 設定靜態 ip

Deepin 設定靜態 ip

1 獲取 網絡卡的名稱

  • 開啟終端輸入
yang@yang:~$ ifconfig -a
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.217.82  netmask 255.255.255.0  broadcast 192.168.217.255
        inet6 fe80::2e4d:54ff:fe9b:2dc4  prefixlen 64  scopeid 0x20<link>
        ether 2c:4d:54:9b:2d:c4  txqueuelen 1000  (Ethernet)
        RX packets 2774  bytes 283691 (277.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 480  bytes 67196 (65.6 KiB)
        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 826  bytes 67458 (65.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 826  bytes 67458 (65.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • enp3s0 網絡卡名稱

2 新增 IP 地址

  • 在 /etc/network/interfaces 中新增內容
# 靜態ip
auto enp3s0
# enp3s0 是網絡卡名稱
iface enp3s0 inet static
# 設定 DHCP 為動態
address 192.168.217.82
# 要設定的靜態 IP 地址
netmask 255.255.255.0
# 子網掩碼
gateway 192.168.217.1
# 閘道器
dns-nameserver 119.29.29.29
# dns 地址

3 重啟網路

sudo /etc/init.d/networking restart

4 如果出現 出現域名解析暫時失敗

  • 開啟 /etc/resolv.conf , 新增 nameserver 119.29.29.29
sudo vim /etc/resolv.conf

# 編輯檔案
#i Generated by NetworkManager
nameserver 119.29.29.29
# 新增一行
  • 重啟網路
sudo /etc/init.d/networking restart

4 參考

簡書
csdn