debian linux 配置网络配置,Debian系统下如何配置网络

Debian系统的网络配置和其他一些系统的过程是一样的,包括配置IP、网关和DNS等等,本文就来简单介绍一下Debian系统下配置网络的过程。

066bb6d62be1e4b3381d269fefccf1be.png

1、设置IP地址、网关

cp /etc/network/interfaces /etc/network/interfaces.bak # 备份原有配置文件

vi /etc/network/interfaces # 编辑网网卡配置文件

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0 # 开机自动连接网络

allow-hotplug eth0

iface eth0 inet static # static表示使用固定ip,dhcp表述使用动态ip

address 192.168.21.166 # 设置ip地址

netmask 255.255.255.0 # 设置子网掩码

gateway 192.168.21.2 # 设置网关

按 ESC 键,然后输入 :eq 保存并退出。

下面的版本便于复制, 因为配置文件里最好不要有中文:

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

allow-hotplug eth0

iface eth0 inet static

address 192.168.21.166

netmask 255.255.255.0

gateway 192.168.21.1

2、设置dns

cp /etc/resolv.conf /etc/resolv.conf.bak # 备份原有dns配置文件

vi /etc/resolv.conf # 编辑配置文件

nameserver 127.0.0.1

nameserver 8.8.8.8 # 设置首选dns

nameserver 8.8.4.4 # 设置备用dns

按 ESC 键,然后输入 :eq 保存并退出。

下面的版本便于复制, 因为配置文件里最好不要有中文:

nameserver 127.0.0.1

nameserver 8.8.8.8

nameserver 8.8.4.4

3、重启网络

service networking restart # 重启网络

至此,IP地址、网关、DNS配置完成,现在系统已经可以上网了。

以上就是Debian系统下进行网络配置的方法了,IP地址、网关和DNS设置,每一步都不能省略哦。

 欢迎大家私信,参与技术交流群

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值