I am new to networking. I just want to know the difference in ethrenet packet structure for tag based VLAN and port based VLAN. For tag VLAN, a VLAN tag is added to the ethernet packet frame so that any packet having that tag is considered belonging to the respective VLAN. How do the same is happening for port VLAN? How do a packet is being identified if it belongs to particular port VLAN? Any help is highly appreciated.
Inside a switch, the VLAN is just associated with a frame. How the frame is stored while it is being processed varies and doesn't matter for us.
A port-based VLAN has switch ports assigned to it directly. In reverse, each port is assigned a VLAN and only ports in the same VLAN communicate with each other. A frame is associated with its port VLAN when entering the switch, and forwarding is restricted accordingly. Frames are generally untagged.
Port-based VLANs work fine with a single switch but when using multiple switches you'd want to keep a VLAN association across your network, without requiring a dedicated link for each VLAN.
VLAN tags allow a switch to pass a frame's VLAN association to another switch. That way, you can use a single link between switches for all used VLANs - this is called a (VLAN) trunk.
VLAN trunks are also used with servers, so they can attach to multiple VLANs using a single NIC or LAG group.