Linux中配置網路地址,主機名

俄又不亂來發表於2018-08-13

Linux中配置網路地址,主機名

臨時設定主機名 # hostname hello

exit退出終端,再重新進入生效

永久設定主機名

echo “hello” > /etc/hostname 或

vim /etc/hostnam

cat /etc/hostname

hello
重啟計算機生效

reboot

檢查結果

hostname

hello
配置靜態ip地址引數
1.檢視當前主機的網路卡裝置

nmcli connection show

名稱 UUID 型別 裝置
System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0
2.修改連線 “System eth0” 的配置
nmcli connection modify “System eth0” ipv4.method manual ipv4.addresses “172.25.0.11/24” connection.autoconnect yes
3.重新啟用連線 “System eth0 “,通過 up指令啟用,必要時可以先down再up

nmcli connection up “System eth0”

4.確保系統服務NetworkManager開機自啟:

systemctl restart NetworkManager

systemctl enable NetworkManager

5.4)檢查修改結果,確認無誤
檢查IP地址:

ifconfig eth0


相關文章