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

Linux 修改 IP、主機名、DNS、閘道完整指令集:即時生效與開機永久生效雙模式

編輯:Linux 系統常見問題解答
項目即時生效 (重啟失效)永久生效 (修改設定檔)
IP 位址ifconfig eth0 192.168.0.20 netmask 255.255.255.0編輯 /etc/sysconfig/network-scripts/ifcfg-eth0
預設閘道route add default gw 192.168.0.254同 ifcfg-eth0 設定 GATEWAY
DNS編輯 /etc/resolv.conf (即時生效且永久)
主機名hostname newname編輯 /etc/sysconfig/network 設定 HOSTNAME

注意: 即時指令適合臨時測試,生產環境請務必同步修改設定檔。ifcfg-eth0 關鍵參數:BOOTPROTO=static、IPADDR、NETMASK、GATEWAY、ONBOOT=yes。修改後 service network restart 或 systemctl restart network 生效。

Copyright © Windows教程網 All Rights Reserved