TShopping

 找回密碼
 註冊
搜索
查看: 2452|回復: 0
打印 上一主題 下一主題

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 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
複製代碼




 

臉書網友討論
*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-26 03:31 , Processed in 1.277384 second(s), 25 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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