Debian中配置静态IP

默认安装Debian的时候是用dhcp服务的,有时我们需要设置一下静态IP。

一共涉及两个文件的修改

/etc/network/interfaces

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
        address 192.168.2.121
        netmask 255.255.255.0
        gateway 192.168.2.2

IP地址,掩码,gateway什么的,你应该已经知道,或者可以咨询当地网络管理员

/etc/resolv.conf里面设置DNS服务器,在这种情况下应该就是gateway的地址

nameserver 192.168.2.2            #因为我这里网关就是DNS服务器所以是相同的

最后reboot或者#/etc/init.d/networking restart 

posted on 2018-09-11 23:06  K行云流水  阅读(2957)  评论(0编辑  收藏  举报