找回密碼
 註冊
搜索
查看: 2849|回復: 0

[教學] Ubuntu 16 網路設定 - 固定 IP

[複製鏈接]
發表於 2018-4-23 13:30:21 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
在跑 Ubuntu 時,Ubuntu 會自動偵測 DHCP 網路並自動取得 IP,不過我們也可以透過文字介面來手動設定,以備不時之須。

1. 修改 Ethernet 網路設定


  1. #vi /etc/network/interfaces Enter

  2. auto eth0
  3. iface eth0 inet static  # 固定 (靜態) IP。
  4. pre-up ifconfig eth0 hw ether ea:27:42:87:76:01 //預設網路卡 eth0 MAC位置
  5. address 192.168.1.103 # IP 位址。
  6. netmask 255.255.255.0   # 網路遮罩。
  7. gateway 192.168.1.254 # 預設閘道。
  8. dns-nameservers 8.8.8.8 # dns IP
複製代碼


2. 修改完可使用以下指令重新啟動網路讀取網路設定。

  1. #/etc/init.d/networking restart
複製代碼



修改reslov.conf

  1. vim /etc/resolv.conf
  2. nameserver 168.95.1.1 #hinet
複製代碼
若網路環境為「中華電信 ADSL 固定 IP 服務」,除了以上動作還得另行設定 PPPoE 撥接。

若 /etc/network/interfaces 設定檔內原先不是「auto eth0」而是「allow-hotplug eth0」時,改完設定後須重新開機才會運作,上方的重新啟動指令無效。

查看linux版本:

3.到服务器执行 lsb_release -a ,即可列出所有版本信息,例如:


  1. # lsb_release -a
複製代碼
  1. No LSB modules are available.                                                                                          
  2. Distributor ID: Ubuntu                                                                                                  
  3. Description:    Ubuntu 16.04.2 LTS                                                                                      
  4. Release:        16.04                                                                                                   
  5. Codename:       xenial
複製代碼

xxx1.png

 
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|TShopping

GMT+8, 2025-5-1 00:07 , Processed in 0.025950 second(s), 24 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回復 返回頂部 返回列表