Introduction to Networking Switch Operations
Setting IP Address and Default Gateway We need to configure the switch with an IP address to be able to remotely access it We also need to configure the switch with a default gateway if we want to be able to remotely login and manage the switch from outside the subnet it is on We store the IP address information as VLAN1, but the default gateway is universal If we plan to only access the switch through the command port, we don’t need to assign it an IP address, since it can perform its function without one
Commands to set IP Address and Default Gateway switch#config terminal (to enter terminal configuration) switch(config)#interface vlan 1 (to enter vlan 1 configuration) switch(config-if)#ip address (IP ADDRESS) (SUBNET MASK) (This is the command that sets the IP address and subnet mask. Replace (IP ADDRESS) (SUBNET MASK) with their actual values switch(config-if)#no shutdown (This activates the interface) switch(config)#ip default-gateway (IP ADDRESS) (This sets the ip address of the default gateway by substituting (IP ADDRESS) with the proper value. Also no that it is config, not config-if, since it is changing the default gateway for all interfaces, you must be in terminal configuration mode
CAM Tables Switches have a table in memory called the Content Addressable Memory (CAM) table The CAM table stores the relationship between MAC address on the network and what port each one is connected to Switches start with an empty CAM and must learn where devices are to build up its table The process of building up and utilizing the CAM table can be encapsulated into three processes: learning, forwarding and filtering
Learning Let’s say we have a host trying to send a frame to another host on the subnet the switch is on The first this the switch does is to compare the sender MAC address to its entry on the CAM table. If the entry isn’t there, or if it doesn’t match the port (if a cable is moved for example) then the MAC address and port are stored in the CAM table. The switch now knows to send frames addressed to that MAC address down that port The switch then looks at the destination MAC address. If the switch hasn’t built up its CAM table yet and the MAC address is not there, then it has to flood the rest of the ports with the frame to ensure that the host gets it. The hosts that this message is not addressed to will discard it
Forwarding The switch will only have a full CAM table once every host has sent out a message or replied to a message sent to it Once it has a host’s MAC address and port assignment in its CAM table, then it can intelligently forward data where it needs to go, and will no longer flood the ports with messages addressed to that MAC address
Filtering CAM table entries are not one-to-one. If a hub is connected to a port on the switch, multiple MAC address may be assigned to one port If this happens, the switch will use intelligent filtering to prevent excess network communication Let’s say a host connected to a hub (which is connected to a switch) wants to communicate to another host on that hub If the MAC addresses of both hosts are stored on the switch’s CAM table, it will recognize that the destination port and sending port match, and it will assume that the host got the message already and discard it
Switch Commands Here is a table of basic commands to configure a Cisco Switch