Debian之网络配置

aqhby
2025-07-16 / 0 评论 / 2 阅读 / 正在检测是否收录...

网络配置

安装debian server 版本后配置IP操作:

IP设置 通过 编辑 /etc/network/interfaces 文件, 执行 service networking restart 生效

设置静态IP

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
allow-hotplug ens33
iface ens33 inet static
address 192.168.1.81
netmask 255.255.255.0
gateway 192.168.1.1
# This is an autoconfigured IPv6 interface
iface ens33 inet6 auto

设置动态IP

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
allow-hotplug ens33
iface ens33 inet dhcp
# This is an autoconfigured IPv6 interface
iface ens33 inet6 auto
0

评论 (0)

取消