flykey
发布于 2025-12-23 / 2 阅读
0

Debian网络接口配置文件

配置目录:/etc/network/interfaces

# 该文件用于定义系统中可用的网络接口,以及接口的激活方式
# 更多配置细节请参考 interfaces(5) 手册页

# 加载 /etc/network/interfaces.d/ 目录下的所有网络接口配置文件
source /etc/network/interfaces.d/*

# 本地回环网络接口配置
auto lo          # 系统启动时自动激活lo回环接口
iface lo inet loopback  # 将lo接口配置为IPv4回环模式

# 主网络接口配置
auto ens18       # 系统启动时自动激活ens18主网卡
iface ens18 inet static  # 将ens18接口配置为IPv4静态IP模式
    address 192.168.5.5/24  # 设置网卡IP地址及子网掩码(/24 = 255.255.255.0)
    gateway 192.168.5.1     # 设置默认网关地址
    dns-nameservers 192.168.5.1  # 设置DNS服务器地址(优先使用网关作为DNS)