CentOS6上配置靜態IP地址

來源:互聯網
上載者:User

CentOS6上配置靜態IP地址
問題預設情況下,CentOS 6安裝沒有網路接入相關配置,需要你對網路介面進行配置。解決方案查看預設介面配置介面相關配置儲存在/etc/sysconfig/network-scripts目錄下,下面顯示的是預設的介面配置。[plain]view plaincopy

  1. [root@CentOS65network-scripts]#more/etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE=eth0
  3. HWADDR=00:0C:29:C1:48:03
  4. TYPE=Ethernet
  5. UUID=b2bbb718-caa6-46c3-ae12-587cbedfd5fa
  6. ONBOOT=no
  7. NM_CONTROLLED=yes
  8. BOOTPROTO=dhcp
配置介面靜態地址[plain]view plaincopy
  1. #vi/etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE="eth0"
  3. NM_CONTROLLED="yes"
  4. ONBOOT=yes
  5. HWADDR=A4:BA:DB:37:F1:04
  6. TYPE=Ethernet
  7. BOOTPROTO=static
  8. UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
  9. IPADDR=10.220.33.108
  10. NETMASK=255.255.255.0
配置網關[plain]view plaincopy
  1. #vi/etc/sysconfig/network
  2. NETWORKING=yes
  3. HOSTNAME=centos6
  4. GATEWAY=10.220.33.1
重啟網路介面[plain]view plaincopy
  1. [root@CentOS65network-scripts]#/etc/rc.d/init.d/networkrestart
  2. Shuttingdowninterfaceeth0:[OK]
  3. Shuttingdownloopbackinterface:[OK]
  4. Bringinguploopbackinterface:[OK]
  5. Bringingupinterfaceeth0:Determiningifipaddress10.220.33.108isalreadyinusefordeviceeth0...
  6. [OK]
配置DNS伺服器[plain]view plaincopy
  1. #vi/etc/resolv.conf
  2. nameserverx.x.x.x#Replacewithyournameserverip
  3. nameservery.y.y.y#Replacewithyournameserverip
查看介面配置使用"ip a"或ifconfig命令可以查看當前介面配置資訊參考資料1.Centos:Interface configuration files

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.