Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Ubuntu 設定靜態 IP 完整範例:/etc/network/interfaces 與 /etc/resolv.conf 雙檔案配置

編輯:Linux 系統常見問題解答

網路介面設定 /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.100
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    up route add default gw 192.168.1.1
    down route del default gw 192.168.1.1

DNS 設定 /etc/resolv.conf

nameserver 202.96.128.86
nameserver 114.114.114.114

修改後 sudo /etc/init.d/networking restart 或 sudo systemctl restart networking 生效。
注意: Ubuntu 17.10+ 採用 Netplan (/etc/netplan/*.yaml),舊檔案可能不生效,請依版本選擇配置方式。

Copyright © Windows教程網 All Rights Reserved