如何在linux系統中設定靜態ip位址

2021-08-14 01:52:27 字數 1214 閱讀 6996

分步閱讀

本篇主要是介紹一下在linux系統中設定靜態ip位址方法。

在終端中輸入:vi /etc/sysconfig/network-scripts/ifcfg-eth0

開始編輯,填寫ip位址、子網掩碼、閘道器、dns等。其中「紅框內的資訊」是必須得有的。

編輯完後,儲存退出。

重啟網路服務。service network restart或/etc/init.d/network restart

ping閘道器,ping外網進行測試。都能ping通表示網路正常。

摘要:---修改ip位址---

即時生效:

# ifconfig eth0 192.168.1.155 netmask 255.255.255.0

重啟生效:

修改/etc/sysconfig/network-scripts/ifcfg-eth0

---修改default gateway---

即時生效:

# route add default gw 192.168.1.1

重啟生效:

修改/etc/sysconfig/network-scripts/ifcfg-eth0

---修改dns---

修改/etc/resolv.conf

修改後即時生效,重啟同樣有效

---修改host name---

即時生效:

# hostname test1

重啟生效:

修改/etc/sysconfig/network

from:

如何在linux系統中設定靜態ip位址

本篇主要是介紹一下在linux系統中設定靜態ip位址方法。1在終端中輸入 vi etc sysconfig network scripts ifcfg eth0 編輯完後,儲存退出。重啟網路服務。service network restart或 etc init.d network restart ...

如何在linux系統中設定靜態ip位址

1 在終端中輸入 vi etc sysconfig network scripts ifcfg eth0 2 開始編輯,填寫ip位址 子網掩碼 閘道器 dns等。其中 紅框內的資訊 是必須得有的 3 編輯完後,儲存退出 shift i wq 4 重啟網路服務。service network rest...

如何在linux系統中設定靜態ip位址

本篇主要是介紹一下在linux系統中設定靜態ip位址方法。在終端中輸入 vi etc sysconfig network scripts ifcfg eth0 編輯完後,儲存退出。重啟網路服務。service network restart或 etc init.d network restart p...