在unbuntu中修改ip为静态

来源:互联网 发布:2004年nba总决赛数据 编辑:程序博客网 时间:2024/04/30 06:48

修改ip为静态
1. 用 sudo vi /etc/network/interfaces,修改 IP 地址。  
  代码:
 
  # This file describes the network interfaces 
available on your system 
# and how to activate them. For more 
information, see interfaces(5). 
 
# The loopback network interface 
auto lo 
iface lo inet loopback 
 
# This is a list of hotpluggable network 
interfaces. 
# They will be activated automatically by 
the hotplug subsystem. 
mapping hotplug 
script grep 
map eth0 
 
# The primary network interface 看在
#要修改的就是这个地方
auto eth0 
 iface eth0 inet static 
address 192.168.1.156 
netmask 255.255.255.0 
network 192.168.1.0 
broadcast 192.168.1.255 
gateway 192.168.1.1

sudo /etc/init.d/networking restart 重新启动网络