CentOS manually configure DHCP network

hosomikai
1 min readSep 23, 2020

--

Photo by Robynne Hu on Unsplash

STEP1. 編輯網卡的設定檔

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0

靜態IP設定

DEVICE=eth0
BOOTPROTO=static
HWADDR=4c:32:75:8a:1a:23
IPADDR=10.88.201.9
NETMASK=255.255.255.0
ONBOOT=yes

使用DHCP動態分配IP

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=4c:32:75:8a:1a:23
ONBOOT=yes

STEP2. 儲存設定後,重新啟動網卡

$ /etc/init.d/network restart

or

$ service network restart

--

--