默认安装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 

相关文章:

  • 2021-06-09
  • 2021-09-23
  • 2021-08-08
  • 2021-12-04
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2022-01-10
  • 2021-05-29
  • 2021-04-24
相关资源
相似解决方案