設定固定IP位址

2021-06-16 10:34:34 字數 811 閱讀 3029

linux

上可以通過

ifconfig

和route

命令新增

ip別名。

現在我們在eth0

上新增兩個

ip別名

192.168.0.111

和192.168.0.112

:shell>ifconfig 

eth0:1 

192.168.0.111 

broadcast 

192.168.0.255 

netmask 

255.255.255.0 up

shell>route 

add 

-host 

192.168.0.111 

dev 

eth0:1

shell>ifconfig 

eth0:2 

192.168.0.112 

broadcast 

192.168.0.255 

netmask 

255.255.255.0 up

shell>route 

add 

-host 

192.168.0.112 

dev 

eth0:2

但是,通過ifconfig

和route

配置的ipd

別名在伺服器重啟後會訊息,不過可以將這兩條

ifconfig

和route

命令新增到

/etc/rc.local

檔案中,讓系統開機自動執行。

docker設定固定ip位址

docker安裝後,缺省會建立下面三種網路型別 root centos mysql01 root centos mysql01 data docker network ls network id name driver scope cab735099128 bridge bridge local 1...

Docker 設定固定IP位址

檢視docker的網路型別 docker network ls 檢視docker下網路模式 network id name driver scope 9781b1f585ae bridge bridge local 1252da701e55 host host local 237ea3d5cfbf ...

Linux下設定固定IP位址

因為專案開發的需要,需要將開發測試機設定固定ip,以便訪問。下面就主要說明一下在linux下如何設定固定ip。首先可以通過 ifconfig 命令檢視當前的ip位址資訊 enp3s0 這個要具體看你 etc sysconfig network scripts目錄下的實際名稱 inet 你現在的ip位...