看板 Linux 關於我們 聯絡資訊
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> ... 我主要的問題是在,這麼做有沒有甚麼差別,或是有沒有甚麼優劣呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.91.31
hsiaulong:設定虛擬介面(加label)可以個別啟用某個ip組態的設定 05/16 18:40
soem:感謝 05/17 10:36