Friday, 7 February 2025

Difference Between Access Port vs Trunk Port vs Hybrid Port

 

Ethernet Layer 2 Port Type


Access Port vs Trunk Port vs Hybrid Port


Interface-based VLAN division depends on the following switch port types:


Access port


  • An access port is used to connect to a user terminal (such as a user PC or server) that cannot identify a tag or distinguish VLAN members.

  • The NICs of these devices connected to the Access port tend to send and receive only untagged frames.

  • An Access port can be added to only one VLAN.


Trunk port


  • A trunk port allows data frames of multiple VLANs to pass through. These data frames are differentiated by 802.1Q tags.

  • A trunk port is used to connect devices such as switches, routers, firewalls, and APs.


Hybrid port


  • A hybrid port can be used to connect user terminals (such as user hosts and servers) that cannot identify tags, switches, routers, voice terminals, and APs that can send and receive tagged and untagged frames at the same time.

  • Users can specify whether a hybrid port carries a tag when sending data frames of a certain VLAN or some VLANs. The default port type of Huawei devices is hybrid, and only Huawei switches have the hybrid port.



Introduction of Access Port


Access port


As shown in the preceding figure, four scenarios are described.


  • Scenario 1: The interface receives untagged frames.

The switch adds a PVID tag to the frame and forwards the tagged frame(flooding, forwarding, discarding).


  • Scenario 2: The interface receives tagged frames.

The switch checks whether the VID in the tag of the frame is the same as the PVID.

If they are the same, the Tagged frame is received or forwarded.

If they are different, the Tagged frame is discarded.


  • Scenario 3: The VLAN ID of the frame is the same as the port PVID.

First, strip the label of the frame, and then send it out of that interface.


  • Scenario 4: The VLAN ID of the frame is different from the port PVID

Disables sending the frame out of the interface.


Features of the access port

Only the data frames with the same VLAN ID as the port PVID are allowed to pass.



Introduction of the Trunk port


Trunk Port


As shown in the preceding figure, four scenarios are described.


  • Scenario 1: The interface receives untagged frames.

The switch adds the PVID to the frame and checks whether the PVID is in the list of allowed VLAN IDs. 

If yes, the Tagged frame is received or forwarded.

If not, the label frame is directly discarded.


  • Scenario 2: The interface receives tagged frames.

The switch checks whether the VID in the tag of the frame is in the list of allowed VLAN IDs. 

If yes, the Tagged frame is received or forwarded.

If not, the Tagged frame is discarded.


  • Scenario 3: The VLAN ID of the frame is the same as the port PVID.

When a tagged frame arrives at a trunk port from another port on the switch, if the VID in the tag of the frame is in the list of allowed VLAN IDs, the system compares whether the VID in the tag is the same as the PVID of the port.

If they are the same, the switch removes the tag of the tagged frame and sends the untagged frame out of the link.

Note: If the VLAN ID is not in the list of allowed VLANs, the frame cannot be sent from the interface.


  • Scenario 4: The VLAN ID of the frame is different from the port PVID.

When a tagged frame arrives at a trunk port from another port on the switch, if the VID in the tag of the frame is in the list of allowed VLAN IDs, the system compares whether the VID in the tag is the same as the PVID of the port.

If they are different, the switch does not strip the tag of the tagged frame but sends it directly off the link.

Note: If the VLAN ID is not in the list of allowed VLANs, the frame cannot be sent from the interface.


For the trunk port, you must configure a list of allowed VLAN IDs in addition to PVIDs. VLAN 1 exists by default.



Working Procedure of a Layer 2 Switch with VLAN and Trunk Functions


Access Port vs Trunk Port vs Hybrid Port


When a switch interface receives a data frame:


  1. Construct a MAC address table by learning source MAC addresses.


  2. Add PVID (Tag)


  3. Forwarding Data Frames Based on the Destination MAC Address (VLAN Range)


    MAC address table changes:

    1) If the data frame is broadcast or multicast, the switch floods the data frame.

    2) For unicast data frames, the switch queries the MAC address table and forwards the frames.


  4. Forwards data frames through the outbound interface.


    1) Remove PVID (tag).

    2) Keep label forwarding. - Trunk port



Introduction of Hybrid port


Hybrid Port


As shown in the preceding figure, four scenarios are described.


  • Scenario 1: The interface receives untagged frames.

The switch adds a PVID tag to the frame and checks whether the PVID is in the untagged or tagged VLAN ID list.

If yes, the Tagged frame is received or forwarded.

If not, the Tagged frame is discarded.


  • Scenario 2: The interface receives tagged frames.

The switch checks to see if the VID in the tag of this frame is in the list of untagged or tagged VLAN IDs.

If yes, the Tagged frame is received or forwarded.

If not, the Tagged frame is discarded.


Summarize scenario 3 and scenario 4. The hybrid port transmits data frames:


  • When a tagged frame arrives at a hybrid port from another interface on the switch, if the VID in the tag of the frame is neither in the untagged VLAN ID list nor in the tagged VLAN ID list, the tagged frame is discarded.


  • When a tagged frame arrives at a hybrid port from another interface on the switch, if the VID in the tag of the frame is in the untagged VLAN ID list, the switch removes the tag from the tagged frame. Then, the untagged frame is sent out over the link.


  • When a tagged frame arrives at a hybrid port from another interface on the switch, if the VID in the tag of the frame is in the tagged VLAN ID list, the switch does not remove the tag from the tagged frame but directly sends the tagged frame over the link.


For a hybrid port, you need to configure the PVID and two VLAN ID lists that allow packets to pass through. One is the untagged VLAN ID list and the other is the tagged VLAN ID list. By default, VLAN 1 is in the untagged VLAN list. The frames of all VLANs in the two allowed lists are allowed to pass through the hybrid port.


Features of the Hybrid port


  • A hybrid port allows only the data frames whose VLAN IDs are in the allowed list to pass through.

  • A hybrid port can allow tagged frames from multiple VLANs to pass through, and allow frames from certain VLANs to be tagged and frames from certain VLANs to be untagged.

  • The main difference between a Hybrid port and a Trunk port is that the Hybrid port supports data frames of multiple VLANs without tags.



Configuration of different port types


Access Port vs Trunk Port vs Hybrid Port


As shown in the preceding figure: Both G0/0/1 and G0/0/2 of SW1 are connected to PCs. Therefore, G0/0/1 and G0/0/2 of SW1 are configured as access ports, and G0/0/24 of SW1 is connected to SW2, and this link needs to carry two different VLANs. Therefore, G0/0/24 of SW1 is configured as a trunk port.


The configuration of SW1 is as follows:


  • Configuring an Access Port


[SW1] VLAN batch 10 20 --- Creating VLANs in Batches


[SW1] interface GigabitEthernet 0/0/1 --- Enter the interface view.

[SW1-GigabitEthernet0/0/1] port link-type access --- Set the link type of the interface to Access. 

[SW1-GigabitEthernet0/0/1] port default VLAN 10 --- Configure the default VLAN for the interface and add the interface to the VLAN.


[SW1] interface GigabitEthernet 0/0/2

[SW1-GigabitEthernet0/0/2] port link-type access

[SW1-GigabitEthernet0/0/2] port default VLAN 20


  • Configuring a Trunk Port


[SW1] interface GigabitEthernet 0/0/24

[SW1-GigabitEthernet0/0/24] port link-type trunk--- Set the link type of the interface to Trunk. 

[SW1-GigabitEthernet0/0/24] port trunk pvid vlan 1--- Configuring the Default VLAN for a Trunk Interface 

[SW1-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20--- Adding a Trunk Interface to a VLAN


  • Configuring a Hybrid Port


Now let's think about whether it is possible to replace access and trunk ports with hybrid ports, and how?


Replacing Access Port Configurations with Hybrid Ports


[SW1] interface GigabitEthernet 0/0/1

[SW1-GigabitEthernet0/0/1] Port link-type hybrid --- Set the link type of the interface to hybrid. 

[SW1-GigabitEthernet0/0/1] Port hybrid pvid vian 10 --- Configuring the Default VLAN for a Hybrid Interface 

[SW1-GigabitEthernet0/0/1] Port untagged vian 10 --- Configure the VLANs to which the hybrid interface is added and the frames from the VLANs pass through the interface in untagged mode.


Replacing Trunk Port Configurations with Hybrid Ports


[SW1] interface GigabitEthernet 0/0/24

[SW1-GigabitEthernet0/0/24] Port link-type hybrid

[SW1-GigabitEthernet0/0/24] Port hybrid pvid vian 10

[SW1-GigabitEthernet0/0/24] Port hybrid untagged vlan 10

[SW1-GigabitEthernet0/0/24] Port hybrid tagged vlan 20 --- Configure the VLANs to which the hybrid interface is added and the frames from these VLANs pass through the interface in tagged mode.

Thursday, 2 January 2025

Cisco IOS recovery : error in IOS image after upgradation.How to boot from OLD ios .

 I was upgrading my 2960 switch IOS from 12.2 to 15.0 , but after i upgrade  when i did the reboot to boot from my new IOS the switch got stuck  and could not boot properly .


in console it was not showing anything , and it was stucking before it load the new IOS .

This issue can be the wrong or invalid ios or it can be hardware issue .

Note:-I had not deleted the old ios from the flash and i was trying to reload the switch from that old IOS.

The error is given below.


It loads the image then hangs right here:

File "flash:/c2960s...." uncompressed and installed, entry point: 0x3000
executing..


Let's solve this issue.


1. plug in switch

2. hold mode button for 15 seconds

3. boot into rommon mode

4. type 'flash_init'

5. type 'dir flash:'

6. type 'delete flash:(filename of corrupted IOS)'

7. type 'boot'

Configuration given below.

switch: flash_init
Initializing Flash...
mifs[2]: 10 files, 1 directories
mifs[2]: Total bytes     :    1806336
mifs[2]: Bytes used      :     612352
mifs[2]: Bytes available :    1193984
mifs[2]: mifs fsck took 1 seconds.
mifs[3]: 0 files, 1 directories
mifs[3]: Total bytes     :    3870720
mifs[3]: Bytes used      :       1024
mifs[3]: Bytes available :    3869696
mifs[3]: mifs fsck took 2 seconds.
mifs[4]: 5 files, 1 directories
mifs[4]: Total bytes     :     258048
mifs[4]: Bytes used      :       9216
mifs[4]: Bytes available :     248832
mifs[4]: mifs fsck took 0 seconds.
mifs[5]: 5 files, 1 directories
mifs[5]: Total bytes     :     258048
mifs[5]: Bytes used      :       9216
mifs[5]: Bytes available :     248832
mifs[5]: mifs fsck took 0 seconds.
 -- MORE --
mifs[6]: 1139 files, 37 directories
mifs[6]: Total bytes     :   57931776
mifs[6]: Bytes used      :   48199168
mifs[6]: Bytes available :    9732608
mifs[6]: mifs fsck took 52 seconds.
...done Initializing Flash.

switch: dir flash:
Directory of flash:/
    2  -rwx  3096      <date>               multiple-fs
    3  -rwx  3016      <date>               vlan.dat.renamed
    4  -rwx  1591      <date>               config.text.renamed
    5  -rwx  1915      <date>               private-config.text
    6  -rwx  5         <date>               private-config.text.renamed
    7  -rwx  16312320  <date>               c2960-lanbasek9-tar.150-2.SE11-1.tar
    8  drwx  512       <date>               c2960s-universalk9-mz.122-55.SE7
  588  -rwx  12556     <date>               vlan.dat
  589  -rwx  3547      <date>               config.text
  590  drwx  512       <date>               c2960-lanbasek9-mz.150-2.SE11
 1176  -rwx  107       <date>               info
9732608 bytes available (48199168 bytes used)
switch:
switch:
switch:

switch:  delete flash:c2960-lanbasek9-mz.150-2.SE11/c2960-lanbasek9-mz.150-2.SE11.bin
Are you sure you want to delete "flash:c2960-lanbasek9-mz.150-2.SE11/c2960-lanbasek9-mz.150-2.SE11.bin" (y/n)?y
File "flash:c2960-lanbasek9-mz.150-2.SE11/c2960-lanbasek9-mz.150-2.SE11.bin" deleted
switch: ?
 
switch:
switch: boot
Loading "flash:/c2960-lanbasek9-mz.150-2.SE11/c2960-lanbasek9-mz.150-2.SE11.bin"...flash:/c2960-lanbasek9-mz.150-2.SE11/c2960-lanbasek9-mz.150-2.SE11.bin: no such file or directory
Error loading "flash:/c2960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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
File "flash:/c2960s-universalk9-mz.122-55.SE7/c2960s-universalk9-mz.122-55.SE7.bin" uncompressed and installed, entry point: 0x3000
executing...
              Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.
           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706


Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Mon 28-Jan-13 10:28 by prod_rel_team
Image text-base: 0x00003000, data-base: 0x01B00000
Initializing flashfs...
Using driver version 1 for media type 1
mifs[3]: 10 files, 1 directories
mifs[3]: Total bytes     : 1806336
mifs[3]: Bytes used      : 612352
mifs[3]: Bytes available : 1193984
mifs[3]: mifs fsck took 0 seconds.
mifs[3]: Initialization complete.
mifs[4]: 0 files, 1 directories
mifs[4]: Total bytes     : 3870720
mifs[4]: Bytes used      : 1024
mifs[4]: Bytes available : 3869696
mifs[4]: mifs fsck took 0 seconds.
mifs[4]: Initialization complete.
mifs[5]: 5 files, 1 directories
mifs[5]: Total bytes     : 258048
mifs[5]: Bytes used      : 9216
mifs[5]: Bytes available : 248832
mifs[5]: mifs fsck took 0 seconds.
mifs[5]: Initialization complete.
mifs[6]: 5 files, 1 directories
mifs[6]: Total bytes     : 258048
mifs[6]: Bytes used      : 9216
mifs[6]: Bytes available : 248832
mifs[6]: mifs fsck took 0 seconds.
mifs[6]: Initialization complete.



You can see , its showing that failed to load from 15.0 and then it will automatically boot from 12.0 as default.