`
darkma
  • 浏览: 521550 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类

Ubuntu IP设置

阅读更多

手动临时设置IP

sudo ifconfig eth0 up 192.168.1.10

手动设置IP一般在系统重启后就失效

 

 

静态设置IP

Ubuntu网络配置信息保存在 /etc/network/interfaces 文件中,默认内容如下:

auto eth0

iface eth0 inet dhcp

auto lo
iface lo inet loopback

 

设置静态ip的方法如下:

使用root用户编辑 /etc/network/interfaces

i)注释掉第二行,设置静态ip有关参数

auto eth0

#iface eth0 inet dhcp

 

iface eth0 inet static

address 192.168.1.10

netmask 255.255.255.0

gateway 192.168.1.1

 

auto lo
iface lo inet loopback

 

ii)编辑 /etc/resolv.conf,设置dns

nameserver 202.96.134.86

nameserver 202.106.0.166

 

iii)关闭后重启,使新设置生效

$sudo ifconfig eth0 down

 

$sudo ifconfig eth0 up

 

分享到:
评论
1 楼 chenhongwei0924 2010-11-09  

请指教下! 我的是什么问题
http://ubuntu.group.iteye.com/group/topic/23359

相关推荐

Global site tag (gtag.js) - Google Analytics