關於在一張網卡新增多個ip - Linux
By Poppy
at 2013-05-16T16:28
at 2013-05-16T16:28
Table of Contents
http://linux.vbird.org/linux_server/0140networkcommand.php
參考鳥哥這頁的說明。
基本上大概有兩個方法:
ifconfig eth0:0 192.168.50.50 broadcast 192.168.50.255
ip address add 192.168.50.50/24 broadcast 192.168.50.255 dev eth0 label eth0:0
但是最近在使用某軟體發現,他會在同個interface上bind多個ip,
大概就像這樣加的結果:
ip address add 192.168.50.50/24 broadcast 192.168.50.255 dev eth0
ip address add 192.168.50.51/24 broadcast 192.168.50.255 dev eth0
ip address add 192.168.51.50/24 broadcast 192.168.51.255 dev eth0
就會變成這樣:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc...........
link/ether ..:..:..:..:..:.. brd ff:ff:ff:ff:ff:ff
inet 10.1.30.4/24 brd 10.1.30.255 scope global eth0
inet 192.168.50.50/24 brd 192.168.50.255 scope global eth0
inet 192.168.51.50/24 brd 192.168.51.255 scope global eth0
inet 192.168.50.51/24 brd 192.168.50.255 scope global secondary eth0
也就是說不使用label參數,就不會建出eth0:0, eth0:1 ...
而ifconfig也看不到這些inet
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.30.4 netmask 255.255.255.0 broadcast 10.1.30.255
inet6 .... prefixlen 64 scopeid 0x20<link>
...
我主要的問題是在,這麼做有沒有甚麼差別,或是有沒有甚麼優劣呢?
--
參考鳥哥這頁的說明。
基本上大概有兩個方法:
ifconfig eth0:0 192.168.50.50 broadcast 192.168.50.255
ip address add 192.168.50.50/24 broadcast 192.168.50.255 dev eth0 label eth0:0
但是最近在使用某軟體發現,他會在同個interface上bind多個ip,
大概就像這樣加的結果:
ip address add 192.168.50.50/24 broadcast 192.168.50.255 dev eth0
ip address add 192.168.50.51/24 broadcast 192.168.50.255 dev eth0
ip address add 192.168.51.50/24 broadcast 192.168.51.255 dev eth0
就會變成這樣:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc...........
link/ether ..:..:..:..:..:.. brd ff:ff:ff:ff:ff:ff
inet 10.1.30.4/24 brd 10.1.30.255 scope global eth0
inet 192.168.50.50/24 brd 192.168.50.255 scope global eth0
inet 192.168.51.50/24 brd 192.168.51.255 scope global eth0
inet 192.168.50.51/24 brd 192.168.50.255 scope global secondary eth0
也就是說不使用label參數,就不會建出eth0:0, eth0:1 ...
而ifconfig也看不到這些inet
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.30.4 netmask 255.255.255.0 broadcast 10.1.30.255
inet6 .... prefixlen 64 scopeid 0x20<link>
...
我主要的問題是在,這麼做有沒有甚麼差別,或是有沒有甚麼優劣呢?
--
Tags:
Linux
All Comments
By Brianna
at 2013-05-19T08:48
at 2013-05-19T08:48
By Poppy
at 2013-05-22T04:50
at 2013-05-22T04:50
Related Posts
compile kernel
By Hamiltion
at 2013-05-16T01:16
at 2013-05-16T01:16
compile kernel
By Mary
at 2013-05-16T00:29
at 2013-05-16T00:29
顯示亂碼-putty/透過vi 開檔
By Delia
at 2013-05-15T18:00
at 2013-05-15T18:00
AES字串加解密(跨平台)
By Ina
at 2013-05-15T12:40
at 2013-05-15T12:40
debian桌面問題
By Faithe
at 2013-05-15T10:39
at 2013-05-15T10:39