cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
974
Views
10
Helpful
6
Replies

subinterfaces

nguyen-tan
Level 1
Level 1

Greetings!

I am playing with some equipment with the purpose of learning how things work. I have 2 linux servers connected to a router, each via the ethernet port. I think I should be able to create subinterfaces on the linux machines with ip addresses in different subnets. I think I should be able to ping any subinterface from one server to the other. Should I configure subinterfaces on the router and use them as the default gw for the server?

I have tried a few configurations but I can only ping the one interface on the router that is on the native vlan. I have not been successful in pinging across the router.

Any help would be very appreciated.

1 Accepted Solution

Accepted Solutions

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Tan,

to be able to use vlan based subinterfaces both the router and the linux boxes have to agree on:

encapsulation : 802.1Q

and vlan id tag

example

int f0/0

no ip address

no sh

int f0/0.10

enc dot1q 10

ip address 10.10.10.1 255.255.255.0

int f0/0.20

enc dot1q 20

ip address 10.10.11.1 255.255.255.0

the same has to be done on the linux boxes with the appropriate commands.

Hope to help

Giuseppe

View solution in original post

6 Replies 6

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Tan,

to be able to use vlan based subinterfaces both the router and the linux boxes have to agree on:

encapsulation : 802.1Q

and vlan id tag

example

int f0/0

no ip address

no sh

int f0/0.10

enc dot1q 10

ip address 10.10.10.1 255.255.255.0

int f0/0.20

enc dot1q 20

ip address 10.10.11.1 255.255.255.0

the same has to be done on the linux boxes with the appropriate commands.

Hope to help

Giuseppe

hi Giuseppe,

Thanks for your help. I have it working now. Is there a reason why you have to specify VLANs in this type of scenarios? Why can't you have subinterfaces without vlans?

Hello Nguyen,

Actually your question was probably meant to be: 'Why do you have to use VLAN tagging on subinterfaces?'

Note that by simply creating a subinterface on a physical interface, you are already virtualizing it. If the physical interface is a LAN interface, by creating a subinterface, you are creating a virtual LAN interface, that is, a VLAN. In other words, creating a subinterface on a LAN interface constitutes creating a VLAN.

Distinguishing between various VLANs on a single physical interface is another issue. There must be something added to the Ethernet frames that are received and sent on a interface with subinterfaces, otherwise, frames sent from two different subinterfaces on your Linux box or your router could not be properly differentiated at the other end. You need to use the VLAN tags for that purpose. Each subinterface needs a unique VLAN tag to provide uniqueness for each frame it sends and to know which received frames to process. On Cisco routers, defining a VLAN tag is a required task for a LAN subinterface, otherwise that subinterface will not be operational.

I hope this clarifies things a bit.

Best regards,

Peter

Hello Tan,

the short answer is for forwarding efficiency:

vlan-ids allow to multiplex / demultiplex traffic between different logical subinterfaces in a very simple and so efficient manner.

Otherwise each packet should be examined to decide to what subinterface it is related and this is easy only if the destination is an ip address of one of the subinterfaces.

What if a packet is sent with a destination that is behind one of the subinterfaces (that use the subinterface ip subnet as the next-hop to the final destination)?

How to understand which subinterface should handle the packet?

Be aware that subinterfaces of the same physical interface share the same source MAC address (that of the main interface)

Vlans allow to confine broadcast traffic.

An alternate way to do this would be to use a different mac address for each subinterface.

This would solve the ambiguity problem described above, but it wouldn't help to confine broadcast traffic as vlans do.

Hope to help

Giuseppe

Giuseppe

Is it possible to create mixed mask ranges on a subinterface?

example: fast0/0.1

ip add 10.49.1.4 255.255.0.0

and

fast0/0.20

ip add 10.52.10.0 255.255.255.0

John

Yes absolutely.

Each subinterface is a logical interface and there is no requirement that the subnet masks are all the same on all the subinterfaces.

Jon

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: