CentOS中所有的設(shè)備都是文件.網(wǎng)卡也在文件中定義.
IP的綁定也只需要更改文件.
網(wǎng)卡相關(guān)文件在目錄: /etc/sysconfig/network-scripts
查詢當(dāng)前IP信息:
ifconfig:
eth0 Link encap:Ethernet HWaddr 00:50:56:AC:6B:0F
inet addr:42.51.135.206 Bcast:42.51.135.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fead:6b0f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:374772 errors:0 dropped:0 overruns:0 frame:0
TX packets:35165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28759089 (27.4 MiB) TX bytes:4779278 (4.5 MiB)
在當(dāng)前目錄下有文件:
ifcfg-eth0
在目錄下新建文件:
ifcfg-eth0:1
內(nèi)容如下:
DEVICE=eth0:1
IPADDR=42.51.138.1
NETMASK=255.255.255.0
HWADDR=00:50:56:AC:6B:0F
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
ifcfg-eth0:2
DEVICE=eth0:2
IPADDR=42.51.138.2
NETMASK=255.255.255.0
HWADDR=00:50:56:AC:6B:0F
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
ifcfg-eth0:3
DEVICE=eth0:3
IPADDR=42.51.138.3
NETMASK=255.255.255.0
HWADDR=00:50:56:AC:6B:0F
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
重啟網(wǎng)卡:
service network restart
這時候再查看IP:
eth0 Link encap:Ethernet HWaddr 00:50:56:AC:6B:0F
inet addr:42.51.135.206 Bcast:42.51.135.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fead:6b0f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:384344 errors:0 dropped:0 overruns:0 frame:0
TX packets:35241 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29462159 (28.0 MiB) TX bytes:4791402 (4.5 MiB)
eth0:1 Link encap:Ethernet HWaddr 00:50:56:AC:6B:0F
inet addr:42.51.138.1 Bcast:42.51.138.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:2 Link encap:Ethernet HWaddr 00:50:56:AC:6B:0F
inet addr:42.51.138.2 Bcast:42.51.138.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:3 Link encap:Ethernet HWaddr 00:50:56:AC:6B:0F
inet addr:42.51.138.3 Bcast:42.51.138.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
測試:
在其它機(jī)器上分別 ping 上面幾個IP.
標(biāo)簽:六盤水 麗水 公主嶺 商丘 雅安 河源 廣安 青島
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《CentOS下一張網(wǎng)卡綁定多個IP的方法》,本文關(guān)鍵詞 CentOS,下,一張,網(wǎng)卡,綁定,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。