debian配置静态IP

前言:这篇文章是 矿难机N3450/锐角云/安装debian10图文教程 的延申。

配置静态IP之前先为Debian开启ROOT登录,开启root登录传送门:https://www.vipkj.net/post-3650.html

1.使用root登录系统
2.我们需要编辑如下2个文件

/etc/network/interfaces(配置IP和网关)
/etc/resolv.conf(配置DNS服务器)

3.使用SFTP软件或者vi编辑/etc/network/interfaces
vi /etc/network/interfaces

4.将interface内容
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet dhcp  dhcp表述使用动态ip 
替换为
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet static  #static表示使用固定ip
address 192.168.0.120     #ip地址
netmask 255.255.255.0     #子网掩码
gateway 192.168.0.1       #网关

5.编辑/etc/resolv.conf设置DNS

vi /etc/resolv.conf

nameserver 8.8.8.8 #设置首选dns
nameserver 114.114.114.114 #设置备用dns

6.重启网络
service networking restart 


小提示1:配置时可去掉注释,因为有时候加了注释导致网卡无法起来;
小提示2:如果使用SHH远程配置一定要使用auto参数,不然系统重启后网卡不自启。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情图片

    暂无评论内容