起一个亮瞎人眼的名字 發表於 2023-10-31 00:00:00

Ubuntu Linux系统下设置静态IP的方法

<p>
        Ubuntu的网络参数保存在文件 /etc/network/interfaces中,默认设置使用dhcp,内容如下:</p>
<p>
        # The primary network interface</p>
<p>
        auto eth0</p>
<p>
        iface eth0 inet dhcp</p>
<p>
        设置静态ip的方法如下:</p>
<p>
        (1)编辑 /etc/network/interfaces</p>
<p>
        1.1)将dhcp 一行屏蔽</p>
<p>
        # The primary network interface</p>
<p>
        auto eth0</p>
<p>
        #iface eth0 inet dhcp</p>
<p>
        1.2)添加和静态ip有关的参数</p>
<p>
        # The primary network interface</p>
<p>
        iface eth0 inet static</p>
<p>
        address 192.168.0.10</p>
<p>
        netmask 255.255.255.0</p>
<p>
        gateway 192.168.0.1</p>
<p>
        (2)编辑 /etc/resolv.conf,设置dns</p>
<p>
        nameserver 202.96.134.133</p>
<p>
        nameserver 202.106.0.20</p>
<p>
        (3)执行下面两个命令,启用新设置</p>
<p>
        $sudo ifdown eth0</p>
<p>
        $sudo ifup eth0</p>
頁: [1]
查看完整版本: Ubuntu Linux系统下设置静态IP的方法