Deepin 设置静态 ip
<h2 id="deepin-设置静态-ip">Deepin 设置静态 ip</h2><h3 id="1-获取-网卡的名称">1 获取 网卡的名称</h3>
<ul>
<li>打开终端输入</li>
</ul>
<pre><code class="language-bash">yang@yang:~$ ifconfig -a
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
inet 192.168.217.82netmask 255.255.255.0broadcast 192.168.217.255
inet6 fe80::2e4d:54ff:fe9b:2dc4prefixlen 64scopeid 0x20<link>
ether 2c:4d:54:9b:2d:c4txqueuelen 1000(Ethernet)
RX packets 2774bytes 283691 (277.0 KiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 480bytes 67196 (65.6 KiB)
TX errors 0dropped 0 overruns 0carrier 0collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>mtu 65536
inet 127.0.0.1netmask 255.0.0.0
inet6 ::1prefixlen 128scopeid 0x10<host>
looptxqueuelen 1000(Local Loopback)
RX packets 826bytes 67458 (65.8 KiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 826bytes 67458 (65.8 KiB)
TX errors 0dropped 0 overruns 0carrier 0collisions 0
</code></pre>
<ul>
<li>enp3s0 网卡名称</li>
</ul>
<h3 id="2-添加-ip-地址">2 添加 IP 地址</h3>
<ul>
<li>在 /etc/network/interfaces 中添加内容</li>
</ul>
<pre><code class="language-bash"># 静态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 地址
</code></pre>
<h3 id="3-重启网络">3 重启网络</h3>
<pre><code class="language-bash">sudo /etc/init.d/networking restart
</code></pre>
<h3 id="4-如果出现-出现域名解析暂时失败">4 如果出现 出现域名解析暂时失败</h3>
<ul>
<li>打开 /etc/resolv.conf , 添加 nameserver 119.29.29.29</li>
</ul>
<pre><code class="language-bash">sudo vim /etc/resolv.conf
# 编辑文件
#i Generated by NetworkManager
nameserver 119.29.29.29
# 添加一行
</code></pre>
<ul>
<li>重启网络</li>
</ul>
<pre><code class="language-bash">sudo /etc/init.d/networking restart
</code></pre>
<h3 id="4-参考">4 参考</h3>
<blockquote>
<p>简书<br>
csdn</p>
</blockquote><br><br>
来源:https://www.cnblogs.com/javayanglei/p/13305285.html
頁:
[1]