Hi
I added IP alias to my NIC from 2 different subnets.
I did this by using 2 methods :
--------------------------------
1. ip address add 10.0.0.1/24 brd + dev eth0
ip address add 10.0.1.1/24 brd + dev eth0
2. ip address add 10.0.0.1/24 brd + dev eth0 label eth0:0
ip address add 10.0.1.1/24 brd + dev eth0 label eth0:0
In regard on 1 method :
------------------------
I saw that when I performed cmd `ip address show`, it shows 2 IP.
Code:
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether f0:de:f1:36:5d:86 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global eth0
inet 10.0.1.1/24 brd 10.0.1.255 scope global eth0
But when I perform cmd `ifconfig eth0`, it doesn't show two IPs only one IP.
Code:
[root@oc1825758758 ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr F0:DE:F1:36:5D:86
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:20 Memory:f2600000-f2620000
Both IPs are pinging, so can work.
Why is it so that configuring 2 IPs on 1 interface by using 1 method, hides IP alias ?
In regard on 2 method :
------------------------
When I use this method, linux shows me eth0 and eth0:0 interfaces with different IPs on them and everything is understandable.
BIG QUESTION :
--------------
Whether I need switch port in trunk mode to allow communication to those 2 IPs from different networks or switch port mode access is fine ?
thx for help.