Solaris下更改IP地址

來源:互聯網
上載者:User

Solaris下更改IP地址
 1、ifconfig命令暫時修改

  ifconfig用來配置網卡的IP地址,改動後即生效, 但並不儲存,下次啟動後失效。
  #ifconfig -a                --->得出網卡的名字,一般第一塊100M網卡名為

hme0

  #ifconfig hme0 down         --->先把網卡hme0的服務暫時停止

  #ifconfig hme0 192.168.1.100 netmask 255.255.255.0 up   --->啟動網卡
2、永久更改IP地址

  需要修改以下幾個檔案
  /etc/hosts    加入機器名和ip地址
  例如:   192.168.1.100     sky100 loghost

  /etc/inet/hosts networks netmasks   改3個檔案

  /etc/net/*/hosts  *為3個目錄,改3個目錄下的hosts

  /etc/nodename

  /etc/netmasks  

  例如: 192.168.1.0   255.255.255.0

  /etc/hostname.hme0   更改網卡的IP地址

  例如改為:192.168.1.100

  /etc/defaultrouter   加入網關

  例如:192.168.1.1

  /etc/resolv.conf  加入DNS伺服器
  例如:
  nameserver  202.106.0.20
  nameserver  202.106.196.115

  修改檔案 /etc/nsswitch.conf
  找到這一行hosts : files
  修改為 hosts:      files dns
  即網域名稱不能在/etc/hosts裡找到的話,就會去DNS解析。

  更改完成後重新啟動即可.

  更改了網卡/增加了網卡,系統不能自動啟動該介面服務,這時需要手動建立網口

服務:
  #ifconfig hme0 plumb
  即可以為介面hme0建立網口服務
  相應地,用ifconfig帶unplumb參數可以停止服務並關閉網路

/etc/hostname.hme0 網卡hme0的IP地址

/etc/hosts 網路中主機名稱的IP地址的對應表

/etc/netmasks 設定網路號及網路遮罩

/etc/nsswitch.conf 網域名稱解析的方法及順序

/etc/resolv.conf DNS Server的地址及網域名稱

/etc/defaultrouter 設定預設的網關地址

/etc/nodename 主機名稱

/etc/net/ticlts/hosts

/etc/net/ticots/hosts

/etc/net/ticotsord/hosts 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.