欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

linux 系统修改 ip 地址命令,让虚拟机上网

最编程 2024-07-02 19:59:31
...

编辑网络配置文件:

vi /etc/network/interfaces

在该文件中,找到对应网卡的配置信息,例如:

auto eth0
iface eth0 inet dhcp

修改为:

auto eth0
iface eth0 inet static
address 192.168.1.100  # 设置IP地址
netmask 255.255.255.0  # 设置子网掩码
gateway 192.168.1.1    # 设置网关地址

注意,根据实际情况,IP地址、子网掩码、网关地址需要做相应修改。

推荐阅读