debian配置静态IP

  最近有个困扰,虚拟机下的Debian系统在更换网络环境后ip地址会发生变化,从而影响到个人nfs服务器和Navicat访问数据库,如下是解决方法数据库

 

首先编辑/etc/network/interfaces设置IP地址和网关,最好先备份,若是你要配置的是eth0网卡,设置以下服务器

auto lo网络

iface lo inet loopbackoop

 

# The primary network interfacespa

auto eth0 #设置开机自动链接网络rest

allow-hotplug eth0server

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

address 192.168.199.xxx #设置ip地址ip

netmask http://www.javashuo.com/tag/255.255.255.0 #设置子网掩码get

network 192.168.199.0 #

broadcast 192.168.199.255

gateway 192.168.199.1 #设置网关

 

其次编辑/etc/resolv.conf配置dns,设置以下

 

nameserver 192.168.199.1 # 通常和gateway的地址是一致的

 

最后重启网络

 

service networking restart #重启网络

或者

/etc/init.d/networking restart #记得sudo

相关文章
相关标签/搜索