- 打卡等级:本地老炮
- 打卡总天数:554
- 打卡月天数:15
- 打卡总奖励:551
- 最近打卡:2026-07-15 01:51:04
|
本教程同时适用:Debian 12
在最小安装的 Debian 12系统上 ,我们只有 cli 控制台,没有任何 nmcli 实用程序。要进行静态 IP 地址配置,我们必须编辑 /etc/network/interfaces 文件。
- cat /etc/network/interfaces
复制代码
编辑 /etc/network/interfaces 文件
- vi /etc/network/interfaces
复制代码 将 allow-htplug enp0s3 行替换为 auto enp0s3,并将 dhcp 参数更改为 static。下面是我的示例文件,根据您的环境更改接口名称和 ip 详细信息。
- auto enp0s3
- iface enp0s3 inet static
- address 192.168.1.240/24
- network 192.168.1.0
- broadcast 192.168.1.255
- gateway 192.168.1.1
- dns-nameservers 8.8.8.8
复制代码 保存并关闭文件
要使上述更改生效,请重新启动网络服务
- systemctl restart networking.service
复制代码 验证 ip 地址
|
|