温馨提示×

ubuntu手动设置ip地址的步骤是什么

小亿
126
2023-09-29 07:32:22
栏目: 智能运维

在Ubuntu中手动设置IP地址的步骤如下:

  1. 打开终端。

  2. 使用ifconfig命令查看当前网络适配器的名称。通常为eth0enp0sX

  3. 使用sudo nano /etc/network/interfaces命令编辑网络配置文件。

  4. 在文件中找到与网络适配器对应的行(通常为iface eth0 inet dhcp),将其修改为iface eth0 inet static,表示将使用静态IP。

  5. 在下面的行中添加IP地址、子网掩码、网关和DNS服务器的信息。例如:

address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
  1. 按Ctrl + X,然后按Y保存更改。

  2. 使用sudo service networking restart命令重启网络服务。

  3. 使用ifconfig命令验证IP地址是否已被成功设置。

0