找回密码
 register
搜索
查看: 755|回复: 0

[游戏教程] 在最小安装的 Debian 12/KaliLinux上分配静态 IP 地址

[复制链接]
  • 打卡等级:本地老炮
  • 打卡总天数:528
  • 打卡月天数:17
  • 打卡总奖励:526
  • 最近打卡:2026-06-19 10:50:42
Waylee 发表于 2024-9-4 22:32 | 显示全部楼层 |阅读模式
本教程同时适用:Debian 12
在最小安装的 Debian 12系统上 ,我们只有 cli 控制台,没有任何 nmcli 实用程序。要进行静态 IP 地址配置,我们必须编辑 /etc/network/interfaces 文件。
  1. cat /etc/network/interfaces
复制代码

编辑 /etc/network/interfaces 文件
  1. vi /etc/network/interfaces
复制代码
将 allow-htplug enp0s3 行替换为 auto enp0s3,并将 dhcp 参数更改为 static。下面是我的示例文件,根据您的环境更改接口名称和 ip 详细信息。
  1. auto enp0s3
  2. iface enp0s3 inet static
  3.         address 192.168.1.240/24
  4.         network 192.168.1.0
  5.         broadcast 192.168.1.255
  6.         gateway 192.168.1.1
  7.         dns-nameservers 8.8.8.8
复制代码
保存并关闭文件

要使上述更改生效,请重新启动网络服务
  1. systemctl restart networking.service
复制代码
验证 ip 地址
  1. ip add show
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?register

×
您需要登录后才可以回帖 登录 | register

本版积分规则

QQ|雪舞知识库 ( 浙ICP备15015590号-1 | 萌ICP备20232229号|浙公网安备33048102000118号 )|天天打卡

GMT+8, 2026-6-19 13:03 , Processed in 0.069341 second(s), 33 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表