debian 设置ip

设置ip  打开 /etc/network/interfaces 添加如下内容

luomb@debian:/$ vi /etc/network/interfaces

M

#Thisfiledescribesthenetworkinterfacesavailableonyoursystem

#andhowtoactivatethem.Formoreinformation,seeinterfaces(5).

#Theloopbacknetworkinterface

#autolo

#ifaceloinetloopback

#Theprimarynetworkinterface

#allow-hotplugeth0

#ifaceeth0inetdhcp

autoeth0

ifaceeth0inetstatic

address192.168.50.165

netmask255.255.255.0

gateway192.168.50.1

设置DNS服务器:

 luomb@debian:/$ vi /etc/resolv.conf

nameserver202.96.128.86

nameserver 8.8.8.8

用下面的命令使网络设置生效

sudo /etc/init.d/networking restart

也可以在命令行下直接输入下面的命令来获取地址

sudo dhclient eth0

IP关闭

ifconfig eth0 up

IP打开

ifconfig eth0 down

相关推荐