LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-26-2007, 02:20 AM   #1
fundoos4me
LQ Newbie
 
Registered: Nov 2004
Posts: 17

Rep: Reputation: 0
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
 
Old 10-04-2007, 03:45 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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?

Last edited by win32sux; 10-04-2007 at 03:50 AM.
 
Old 10-04-2007, 02:34 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by win32sux View Post
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.
 
Old 10-04-2007, 02:40 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to route thru virtual interfaces? huseki Linux - Networking 4 03-14-2006 08:13 AM
Virtual Interfaces geony Linux - Networking 6 02-13-2005 11:25 AM
Secondary/Virtual User Accounts? sat86 Linux - Security 0 01-18-2005 04:52 PM
Virtual Interfaces linuxboy69 Linux - Networking 1 12-31-2003 03:08 PM
Virtual Interfaces da_tibmeister Linux - Networking 2 10-15-2003 09:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration