woff 發表於 2018-4-23 13:30:21

Ubuntu 16 網路設定 - 固定 IP

在跑 Ubuntu 時,Ubuntu 會自動偵測 DHCP 網路並自動取得 IP,不過我們也可以透過文字介面來手動設定,以備不時之須。

1. 修改 Ethernet 網路設定

#vi /etc/network/interfaces Enter

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

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

#/etc/init.d/networking restart


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

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

查看linux版本:

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

# lsb_release -a
No LSB modules are available.                                                                                          
Distributor ID: Ubuntu                                                                                                
Description:    Ubuntu 16.04.2 LTS                                                                                    
Release:      16.04                                                                                                   
Codename:       xenial


頁: [1]
查看完整版本: Ubuntu 16 網路設定 - 固定 IP