ubuntu电脑怎么更改ip

1521
2021/4/14 10:18:03
栏目: 智能运维
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

ubuntu电脑更改ip的方法:1.打开终端;2.输入命令打开ubuntu的网络配置文件;3、根据需求修改设置address、gateway、netmask这三个值;4.使用命令使网络设置生效即可。

ubuntu电脑怎么更改ip

具体操作步骤:

1.首先通过快捷键【Ctrl+Alt+T】打开终端命令行模式。

2.输入以下命令打开ubuntu的网络配置文件。

sudo vi /etc/network/interfaces

3.根据自己的需求修改设置address、gateway、netmask这三个值即可。

# The primary network interface iface eth0 inet static

auto eth0

iface eth0 inet static

address 192.168.2.1 #ip地址

gateway 192.168.2.254 #网关

netmask 255.255.255.0 #子网掩码

4.最后使用以下命令使网络设置生效即可。

sudo /etc/init.d/networking restart

相关操作:

为网卡配置静态IP地址

1.首先在终端使用“sudo vi /etc/network/interfaces”命令打开网络配置文件。

2.然后用以下的代码替换有关eth0的行内容,然后输入命令网络配置生效即可。

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.2.1

gateway 192.168.2.254

netmask 255.255.255.0

#network 192.168.2.0

#broadcast 192.168.2.255

sudo /etc/init.d/networking restart #使网络配置生效

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: Ubuntu Zotero引文样式修改方法