本文发布于Cylon的收藏册,转载请著名原文链接~


设置一个网络接口

debian 中网络接口的配置文件是在 /etc/network/interfaces,可以设置 “静态地址” 或 “DHCP”

cat /etc/network/interfaces
# 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
auto ens33
iface lo inet loopback

# The primary network interface
allow-hotplug ens33
iface ens33 inet static
address 10.0.0.14
netmast 255.255.255.0
gateway 10.0.0.2
root@debian-template:~# cat /etc/network/interfaces
# 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
auto ens33
# 使用dhcp配置网络接口
iface eth0 inet dhcp
iface lo inet loopback

# The primary network interface
allow-hotplug ens33
# 使用静态地址配置网络接口
iface ens33 inet static
    address 10.0.0.14
    netmast 255.255.255.0
    gateway 10.0.0.2

Enjoy 👏👏

Reference

NetworkConfiguration

本文发布于Cylon的收藏册,转载请著名原文链接~

链接:https://www.oomkill.com/2024/06/debian-network-configration/

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」 许可协议进行许可。