cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
918
Views
9
Helpful
7
Replies

basic switching

The_guroo_2
Level 2
Level 2

guys can someone p[lease explain basic switching to me plz.....just have few questions.....first of all suppose if i have a new cisco switch like 3560 or 70.....and i take it out from the box.....if i connect three pc's (same subnet) will they communicate with it....i guess they will be able....now the process i m more interested in to learn....how switch learns mac address......the pcs will broadcast traffic as soon as they will be connected or what i sthe method for switch to learn the mac addresses......secondly what is arp and in this scenario how arp will work.....??? thirdly pcs have ip address when pc want to send some thing to otehr pc how switch will transfer the data??? i believe mac address but how swoicth will know where to send the data.....guys i m v new plz help me out.....thanks for looking

7 Replies 7

paul.matthews
Level 5
Level 5

That really is the basics of switching.

Fundamental point one: A switch will by default forward any broadcasts, multicasts or packets to unknown mac addresses to all ports that are in a forwarding state, other than the port on which it was received.

That means when you just plug in three PCs, the first packet sent gets forwarded to both the other PCs.

Fundamental two: When a device transmits a packet via switch, the switch will look at the source MAC address in the packet and add it to the MAC table against the port it has been seen on. From then (subject to expiry by aging) any packets TO that MAC address will be sent only to that port.

ARP; Address resolution protocol - the mechanism by which devices discover the L2 address associated with an IP address. Basically a device will broadcast to ask "who has this IP address?". Being a broadcast (refer to fundamental 1) it gets forwarded by the switch to all active ports so all devices will see it. The device with that address will respond to identify itself. At this point, both devices have sent at least one packet, so both will be in the MAC table.

Device one will then send the data it wants to send, it will use the IP address *AND* the MAC address. The switch will look up the destination mac address in the table and as in this case both have already sent a packet it will find the address and just send the packet out of the port that device is attached to.

Terminology MAC table - the table of addresses (Midia Access Control). CAM - content addressable memory - the memory mechanism normally used to store the MAC table, so that lookups can be done very quickly.

I hope that helps, please rate if it does.

Paul.

Paul

Thanks for such a lovely reply....now my question is that if a new pc is attached to a switch by default switch will not learn it mac address unless someone tries to talk to it or it self that pc tries to talk to it??? is it right.....seconldy u said that arp is when pc broadcast it to all other??? when it requires a mac-address....nmy question is i thought switch broadcast it??? what procedure pc follows to decide that for this address i have to broadcast or unicast......does it have a cam table or routing table??? thanks again waiting for the kind response

For a switch to learn a device, the device must transmit. Until a device sends a packet through the switch the switch does not know where it is.

And ARP is sent by a PC as a broadcast, and the switch will flood a broadcast to all ports.

A PC does not have a CAM table, but does have a routing table (though that is not in use here). To display it use "netstat -rn

"

When a PC wants to send a packet, it uses its ARP table to look at what MAC address to send to. To display it use "arp -a".

When a device is present in the arp table, the PC will send the packet as unicast.

If the device is NOT present, the PC will send an ARP request, and that request is sent as a broadcast at L2 (MAC address).

When a switch receives a packet (unicast) and the address is in the MAC table, it will be sent to the port the device is on, and only that port.

If the packet is a broadcast, multicast or an unknown address, it gets flooded to all ports.

Paul.

Thanks for such a nice reply....now only one confussion is left........if there is a routing table and an arp table in pc.....u have explained the arp table......so why there is a routing table what is it use??? thanks again

Different layers. The ARP table is local L2 info associated with local L3 addresses.

The routing toaable is normally pretty sparse on a PC, often with only one real route in it. This tells the PC about L3 information, which router to use to get to various networks. Typically in a PC it las local information - which subnets are on which network interfaces, and a default route pointing at the defaullt gateway.

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Khan,

an ethernet switch works as a transparent bridge : it is not allowed to modify the user traffic frames.

MAC address learning works in this way:

ports that are enabled and in STP forwarding state will receive traffic from the attached device.

The switch builds its CAM MAC address table by using the following info:

source MAC address of frames

port on which the MAC is heard

Vlan: the vlan to which the port belongs

The first decision the switch needs to take is: the frame is destined to a MAC associated to another port ?

If the answer is yes the frame is forwarded out the port associated with the destination MAC.

IF the MAC destination is learned on the same port on which the frame has been received (this can happen if an hub is connected to the switch port and two PCs to the hub ports) the frame is just filtered=ignored because there is no need to forward it.

a Vlan is a group of switch ports that are in the same broadcast domain : a broadcast sent on one of the port is replicated out all the other ports in the same vlan.

The same happens for: multicast frames with a L2 multicast destination and for unknown unicast frames (until the switch learns out which port the MAC is located)

Factory defaults are : all ports in Vlan1 so yes the three Pcs will be able to communicate.

ARP table:

ARP table is used by a L3 device to map each ip address in the subnet with the corresponding MAC address.

In your case :

each PC has its own ARP table that can contain up to three entries: the other two PCs and the MAC address of SVI vlan1 of the switch if you configure it with an ip address in the same IP subnet.

the L2 switch uses MAC addresses for forwarding and this will work even if the SVI vlan1 is shutted down or configured in another subnet.

Hope to help

Giuseppe

narayanaccna100
Level 1
Level 1

Hi first for vlan 1 we should config the ip that will be the ip of the switch and we can manage through that ip..by logining inn..

ok...

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:

Review Cisco Networking products for a $25 gift card