LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   difference between virtual and secondary interfaces (https://www.linuxquestions.org/questions/linux-networking-3/difference-between-virtual-and-secondary-interfaces-587419/)

fundoos4me 09-26-2007 02:20 AM

difference between virtual and secondary interfaces
 
hello,

Can someone tell me the difference between virtual and secondary interfaces/ip addresses. Thanks in advance.

Thanks
fundoos

win32sux 10-04-2007 03:45 AM

The term "virtual IP" typically means the same as aliased IP. On GNU/Linux, when you create an alias IP, it gets an alias interface assigned to it, which I presume would also be called a "virtual interface". The convention for alias interface names is to use the name of the real interface, followed by a colon and then an integer. Here's an example of what it looks like on my box to set up an alias:
Code:

win32sux@candystore:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:23:34:42:9B:FF 
          inet addr:192.168.1.123  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37373 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45956195 (43.8 MiB)  TX bytes:3957269 (3.7 MiB)
          Interrupt:3 Base address:0x4f00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1941 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1941 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:976076 (953.1 KiB)  TX bytes:976076 (953.1 KiB)

win32sux@candystore:~$ sudo ifconfig eth0:0 10.0.0.223 netmask 255.255.255.0
win32sux@candystore:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:23:34:42:9B:FF 
          inet addr:192.168.1.123  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37373 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45956195 (43.8 MiB)  TX bytes:3957269 (3.7 MiB)
          Interrupt:3 Base address:0x4f00

eth0:0    Link encap:Ethernet  HWaddr 00:23:34:42:9B:FF 
          inet addr:10.0.0.223  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:3 Base address:0x4f00


lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1941 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1941 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:976076 (953.1 KiB)  TX bytes:976076 (953.1 KiB)

win32sux@candystore:~$ ping -c3 10.0.0.223
PING 10.0.0.223 (10.0.0.223) 56(84) bytes of data.
64 bytes from 10.0.0.223: icmp_seq=1 ttl=64 time=0.160 ms
64 bytes from 10.0.0.223: icmp_seq=2 ttl=64 time=0.158 ms
64 bytes from 10.0.0.223: icmp_seq=3 ttl=64 time=0.158 ms

--- 10.0.0.223 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.158/0.158/0.160/0.014 ms
win32sux@candystore:~$

Notice how the MAC address of the alias is the same as the NIC's. As for what "secondary interface" means, it would depend on what "primary" means. My guess is "secondary" refers to a LAN interface while "primary" refers to a WAN one but I'm not really sure. Where'd you hear this terminology?

osor 10-04-2007 02:34 PM

Quote:

Originally Posted by win32sux (Post 2912756)
The term "virtual IP" typically means the same as aliased IP. On GNU/Linux, when you create an alias IP, it gets an alias interface assigned to it, which I presume would also be called a "virtual interface". The convention for alias interface names is to use the name of the real interface, followed by a colon and then an integer.

The term “virtual interface” might also refer to a multiply-tagged interface to be used on a virtual lan (as described by 802.1Q). In this case, it may be used very similarly to ip aliasing, except that with an 802.1Q interface, you may change the MAC address. In this case, you would have one actual physical interface that (through software) responds to two (or more) MAC addresses. For example,
Code:

$ ip addr show
1: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:04:61:02:31:7f brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0
2: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
$ sudo vconfig add eth0 1
$ ip link show
1: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:04:61:02:31:7f brd ff:ff:ff:ff:ff:ff
2: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: eth0.1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop
    link/ether 00:04:61:02:31:7f brd ff:ff:ff:ff:ff:ff
$ sudo ip link set dev eth0.1 address 00:04:61:02:31:7e
$ sudo ip addr add 192.168.2.1/24 dev eth0.1
$ ip addr show
1: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:04:61:02:31:7f brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0
2: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
3: eth0.1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noop
    link/ether 00:04:61:02:31:7e brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.1/24 scope global eth0.1

Notice how in the end, both the link address and the inet address are different for eth0 and eth0.1. Also notice the naming for vlan interfaces involves a dot (“.”) rather than the colon (“:”) used for ip aliasing.

frieza 10-04-2007 02:40 PM

a virtual interface could also apply to a virtual network used by a virtual machine such as vmware to provide a network presence for the virtual machine, this way the virtual machine can access any lan/internet features that the real machine has, another example of a virtual interface would be one vor a VPN (such as hamachi) tho this could be argued to be an alias on the real nic, virtual interfaces usually have their own separate ip address.


All times are GMT -5. The time now is 06:08 AM.