Ubuntu Server 配置静态IP
2020.9.11
跳转目录:
- 01 Ubuntu换源
- 02 Ubuntu Server 配置静态IP
- 03 Ubuntu与主机共享文件
- 04 Ubuntu安装MySQL Cluster
- 05 Ubuntu配置数据结点
- 06 MySQL Server和Client安装
- 07 MySQL Server安装验证
一、VMware配置
- 在"虚拟网络编辑器"中,找到NAT网络,取消勾选“使用本地DHCP服务将IP地址分配给虚拟机”
- 修改子网IP为:192.168.50.0,子网掩码:255.255.255.0
- 点击NAT设置,修改网关IP:192.168.50.2
- 确定保存
二、Ubuntu设置
- 打开网络配置文件
sudo vim /etc/network/interfaces
安装时应该是默认配置了动态IP,因此其文件内容应该如下:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens33
iface ens33 inet dhcp
- 配置静态IP
将动态IP的部分注释掉,然后按照子网分配一个静态IP,例如:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
# auto ens33
# iface ens33 inet dhcp
auto ens33
iface ens33 inet static
address 192.168.50.129
netmask 255.255.255.0
gateway 192.168.50.2
dns-nameservers 114.114.114.114
- 重启,并尝试ping外网
本文详细介绍了如何在Ubuntu Server上配置静态IP地址,包括修改网络配置文件、设置IP地址、子网掩码、网关及DNS服务器等步骤。通过本教程,读者可以轻松掌握Ubuntu Server静态IP的配置方法。

650

被折叠的 条评论
为什么被折叠?



