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