centos7.3配置臨時IP、配置永久IP
一、centos7.3配置臨時IP位址
- 檢視網絡接口
ifconfig 僅僅檢視目前活動狀态的網絡接口
ifconfig eth0 僅檢視eth0網卡狀态資訊
ifconfig -a 即ifconfig -all 檢視所有啟動禁用的網絡接口
ip a 檢視所有的網絡接口資訊
-
啟動關閉網卡
啟動網卡
ifconfig eth0 up
ifup eth0
關閉網卡
ifconfig eth0 down
ifdown eth0
-
臨時IP配置
臨時修改IP位址,立即生效,重新開機伺服器或網絡失效
[root@lucas ~]# ifconfig eth0 192.168.56.111 netmask 255.255.255.0
[root@lucas ~]# ifconfig eth0 192.168.56.112/24
[root@lucas ~]# ifconfig eth0 192.168.56.113 ->預設24掩碼
4 . 重新開機網絡
[root@lucas ~]# systemctl restart network //centos7
[root@lucas ~]# service network restart //centos5/6
[root@lucas ~]# /etc/init.d/network restart //centos5/6