/etc/hostname.interface — 介面身份識別le0 (10Mb), hme0 (100Mb), bge0 (GbE), qfe0 (4-port 100Mb) 等。/etc/hosts。# /etc/hostname.hme0
sunrise
# /etc/hostname.qfe0
sunny
/etc/hosts — 名稱與 IP 映射127.0.0.1 localhost loghost
172.16.255.1 sunrise
172.18.255.1 sunny
系統啟動時讀取 hostname.interface 取得名稱,再查 hosts 解析 IP,完成介面配置。
區別:hostname 指令顯示/設定的是系統主機名 (唯一),而 hostname.interface 是介面別名,一台主機可有多個介面別名。
/etc/netmasks — 子網路遮罩定義非標準網段 (CIDR/子網劃分) 必須配置:
# 格式: 網路號 遮罩
172.16.255.0 255.255.255.0
10.10.10.0 255.255.255.0
標準 A/B/C 類網段可不寫 (核心自動推導)。
/etc/defaultrouter — 預設閘道172.16.255.254
/etc/nsswitch.conf — 名稱服務解析順序hosts: files dns # 先查 /etc/hosts,再查 DNS
ifconfig 即時控制指令| 操作 | 指令範例 |
|---|---|
| 查看所有介面狀態 | ifconfig -a |
| 配置 IP/遮罩並啟用 | ifconfig hme0 172.16.255.1 netmask 255.255.255.0 up |
| 停用介面 | ifconfig hme0 down |
| 建立介面實例 (新增網卡後) | ifconfig hme0 plumb |
| 移除介面實例 | ifconfig hme0 unplumb |
ping -s target_host 56 10 # 發送 10 個 56 byte 封包測試延遲/丟包
ping -s target_host 1472 # 測試 MTU (大封包)
traceroute target_host # 路徑追蹤
netstat -rn # 顯示路由表
snoop -d hme0 host target # 封包擷取分析
/etc/hostname.介面 存在且內容正確。/etc/hosts 包含該名稱對應 IP。/etc/netmasks 定義子網遮罩 (非標準網段)。/etc/defaultrouter 設定閘道。/etc/resolv.conf 配置 DNS 伺服器。/etc/nsswitch.conf 設定 hosts: files dns。svcadm restart network/physical (Solaris 10+) 或 reboot。