Debian Stream 8 通常使用 /etc/network/interfaces 文件配置网络(部分场景可能使用 Netplan,但非主流)。以下是具体步骤:
先确认网卡名称(如 eth0
、enp3s0
等):
ip addr show
编辑网络配置文件:
sudo nano /etc/network/interfaces
添加以下内容(以 eth0
为例):
auto eth0
iface eth0 inet static
address 192.168.1.100/24 # IP地址+子网掩码
gateway 192.168.1.1 # 网关
dns-nameservers 8.8.8.8 8.8.4.4 # DNS服务器
保存后重启网络:
sudo systemctl restart networking
若需自动获取 IP,修改配置为:
auto eth0
iface eth0 inet dhcp
保存后重启网络:
sudo systemctl restart networking
ip addr show eth0
ping 8.8.8.8
nm-connection-editor
配置,但需先安装:sudo apt install network-manager
以上配置适用于 Debian 10/11 及 Stream 8 等版本。