Ubuntu 系统配置IP地址

上一篇 / 下一篇  2009-10-09 11:18:48 / 个人分类:Linux

我的栏目
  • 栏目:Linux

l#l'\^f&X6m/n0对于Ubuntu,IP命令行配置如下

W\M\E&q@0

:~{z DYh U+oZ0sudo vi /etc/network/interfaces51Testing软件测试网o2F T.U z

51Testing软件测试网9DKaG1v9K {q

 

_2mL`@.~t051Testing软件测试网.iheu-lN}3x_2x

1. 动态IP:DHCP51Testing软件测试网 \+y5`9mc)_"t ]o

~0~ rL*ZN7ymI0DHCP配置如下(假设通过eth1上网)

\P_[RFR6p:i|0

tm#N!]Y0E0# The primary network interface - use DHCP to find our address51Testing软件测试网.X0h6d{HD(_y

51Testing软件测试网E4U"^+fV ON H

auto eth1

&M&PK4L3oW051Testing软件测试网:^y1aZxv

iface eth1 inet dhcp //指定为dhcp

,\-M'A#HT9?051Testing软件测试网p0vJ1t FcDZ

然后重启

7W~+om(a.S0o |051Testing软件测试网p e;ME0@rS

sudo /etc/init.d/networking restart51Testing软件测试网Sy&FC(vJ&^Y

51Testing软件测试网TI]9Z;i$Y

 

J2{ l m1A1w-lc'j051Testing软件测试网"M:|1f'qg5v

2. Static IP

+]#~u;zd1eJ}0z051Testing软件测试网+@5w|-h B:\$@

静态IP地址配置如下(假设通过eth1上网)

"p)VBX6[$xD LQ051Testing软件测试网 f&V a#Mr*k:Mt

# The primary network interface

Td2V$~ CN*^j*V051Testing软件测试网~)R:B k$z*U

auto eth1

D*bfN Y,@*b9MZAN051Testing软件测试网3L*bey+f8t3ZsH

iface eth1 inet static //指定为static

CT4O ] X1ix0

a!]k^.U dr0address 192.168.3.90 //IP地址51Testing软件测试网tS1Bx7w#xm

51Testing软件测试网2n._0{.Y\#R8f'Q

gateway 192.168.3.1 //网关51Testing软件测试网QY(l3o(iq[$jk

51Testing软件测试网P.pB7HC/n

netmask 255.255.255.0 //子网掩码51Testing软件测试网 vTK,Qe[}![

-@NbC$Y0同样需要重启

,z/tc0U^` ic,GR%^051Testing软件测试网^:o JQT7P:x

sudo /etc/init.d/networking restart

5p J.z@:cT$b051Testing软件测试网n.~ WSB/nJp._,hq

DNS

9le9lyA3A0

`J`V~#X0如果有必要,配置DNS51Testing软件测试网(mn-}~C)O

D-|.U u)A!q1lD6t$a0sudo gedit /etc/resolv.conf51Testing软件测试网7l)ShdW|Q

51Testing软件测试网!L.u? JY"[:p{L

nameserver 192.168.3.251Testing软件测试网.W5xQ{9V$j|H


TAG: IP Ubuntu

 

评分:0

我来说两句

Open Toolbar