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
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