Discovering computer networks: hands on in the Open Networking Lab
Discovering computer networks: hands on in the Open Networking Lab

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Free course

Discovering computer networks: hands on in the Open Networking Lab

12.3 How are switching decisions made?

In this section you will have a look at how switches make their switching decisions, using the same demonstration network you used in the previous section. You will again be able to see what the frames of data are doing at each stage, with Packet Tracer running in simulation mode.

Watch the video below, which is about 3 minutes long.

How are switching decisions made?

Download this video clip.Video player: 69_how_are_switching_descisions_made.mp4
Skip transcript

Transcript

In this part we are going to look at how a switch works. Switches work at the Network Access layer of the TCP/IP network model, which means that they use MAC addresses to forward frames of data. Although there are more powerful and advanced switches which use IP addresses and operate at the Internet layer as well, most switches know nothing about the Internet layer and only use MAC addresses to make their switching decisions. This means that normal switches do not generate ARP requests or have anything to do with IP addresses.

When a switch is first powered on, its MAC address table will be empty and will contain no addresses. This can also be simulated by issuing the command clear mac-address-table, which we have done in the Packet Tracer network. The MAC address table is currently empty. To populate the MAC table we must generate some traffic between the PCs. In this case we are going to start with a ping from PC2 to Router0. We have set up a table to the left of the diagram which will show you the current entries in the MAC table of Switch1 at the relevant time. PC2 pings Router0. The packet leaves the PC in an Ethernet frame and enters Switch1 on port FastEthernet0/1. When the switch receives the frame, it looks in the Ethernet frame at the source address in that frame. The address is then added to the MAC table and referenced to the port number the frame came in on. The switch looks in its table to see if the destination MAC address is there. Currently it is not, so the switch forwards the frame out of all ports except the one it came in on. This means that both Router0 and PC3 will receive the frame. Only Router0 will get a match to the destination MAC address; PC3 will ignore it completely. When Router0 replies back, the reply frame will contain its own MAC address as the source address and the destination MAC address of PC2. At this point the switch will look at the incoming frame on Gigabit0/2 and read the source MAC address and add it into the MAC table. It will then look at the destination MAC address and see if there is a match. There will now be a match as the MAC address of PC2 was already added to the table previously. The frame will now be sent out only on the port Fa0/1 and on to PC2.

This is the content of Switch1’s MAC address table, just to show you that the table we created to the left of the screen is genuine. In order to complete the network, we need to generate some traffic from PC3 so that its MAC address can be added to the table of the switch too. PC3 pings the router on 172.16.0.1. The frame arrives at the switch and its source address is added to the MAC table. The destination MAC address is checked against the entries in the table. There is a match for port Gigabit0/2, so the switch will send the frame back out on that port to the router. The ping reply frame will leave the router and enter the switch on Gigabit0/2. The switch will record the source MAC address in the table. Because it’s already there, the table will simply be updated with the time-out counter reset; in other words, the entry is refreshed. The switch will then look up the destination MAC address and find that it matches that of PC3 on port Fa0/2. The frame is then sent out of that port where it will be received by PC3, competing the ping. Here we can see the fully populated MAC address table of the switch.

End transcript
 
Interactive feature not available in single page view (see it in standard view).

Activity 5 Test yourself

5 minutes

1. Do switches generate ARP requests?

a. 

(a) Yes


b. 

(b) No


The correct answer is a.

2. What type of addresses do switches store in their switching tables?

a. 

(a) IP addresses


b. 

(b) Postal addresses


c. 

(c) MAC addresses


d. 

(d) Gateway addresses


The correct answer is c.

3. Will switches forward frames out of all ports (except the one the frame came in on) if the destination MAC address is not in the MAC address table?

a. 

(a) Yes


b. 

(b) No


The correct answer is a.

Next you are going to revisit an earlier activity that involved a simple network comprising a switch and four PCs.

Activity 6 Try it out

10 minutes

1. Open PT Anywhere [Tip: hold Ctrl and click a link to open it in a new tab. (Hide tip)] in a new tab or window so you can read these instructions. The ‘spare’ switch and the two PCs at the bottom are for use in step 4 of this activity.

Investigate the network and enter the configuration settings into a copy of the table.

DeviceInterfaceIP addressSubnet maskDefault gateway
Router0G0/0  
PC0   
PC1   
PC2   
PC3   

2. From the CLI of the switch have a look at the MAC address table. You should find the table is currently empty. (Hint: to view the MAC address table you will need to use the command show mac-address-table from the privileged executive mode.)

3. Generate some network traffic by sending a broadcast ping from one of the PCs and then have another look at the table. You should now find that the table has been populated.

4. Add a second switch to the work area, with a couple of PCs connected to it, to create a second isolated network. (Use the spare switch and PCs provided at the bottom for this.) Configure these new PCs with suitable IP addresses and add the configuration details to the table you created in step 1.

5. Generate some network traffic on the new network and then have a look at the MAC address table of the new switch.

6. Now connect your new network to the router by adding a link between the router interface G0/1 and the switch.

7. Configure the router interface G0/1 with an appropriate IP address and add this address as a default gateway on both of the new PCs. Once again, add the configuration details to the table you created in step 1.

8. Try to ping between networks.

9. Examine the routing table from the CLI of the router. Can you see the connected networks (C)? And the IP addresses of the router interfaces (L)? (Hint: use the command show ip route from the privileged executive mode.)

Answer

1. Your table should look like this.

DeviceInterfaceIP addressSubnet maskDefault gateway
Router0G0/0192.168.2.1255.255.255.0
PC0192.168.2.10255.255.255.0192.168.2.1
PC1-192.168.2.11255.255.255.0192.168.2.1
PC2-192.168.2.12255.255.255.0192.168.2.1
PC3-192.168.2.13255.255.255.0192.168.2.1

2. If there were any entries in the MAC address table, you may have accidentally generated some network traffic. You can clear the MAC address table with the command clear mac-address-table.

3. The broadcast address for this network is 192.168.2.255 . You should have seen replies come in from each of the other three PCs and that the MAC address table now has five entries – one for each of its connected interfaces.

4. You could have chosen any private IP addresses for the two new PCs but, of course, they should both belong to the same network. For example, 192.168.8.10 and 192.168.8.11.

5. Again, you need to use the broadcast address for this network. For the example IP addresses given above, this would be 192.168.8.255. Once again, your ping should have populated the switch’s MAC address table.

6. Router interface 0/1 needs to be configured with a suitable IP address which will be the same for the PCs’ default gateways. For the example IP addresses given above, this would be 192.168.8.1. Using these example IP addresses, the complete configuration table would be:

DeviceInterfaceIP addressSubnet maskDefault gateway
Router0G0/0192.168.2.1255.255.255.0
PC0192.168.2.10255.255.255.0192.168.2.1
PC1192.168.2.11255.255.255.0192.168.2.1
PC2192.168.2.12255.255.255.0192.168.2.1
PC3192.168.2.13255.255.255.0192.168.2.1
PC4192.168.8.10255.255.255.0192.168.8.1
PC5192.168.8.11255.255.255.0192.168.8.1
Router0G0/1192.168.8.1255.255.255.0 

7. If your ping between the two networks was unsuccessful, it may have been because the default gateways on the PCs were not correctly set.

OPNL_1

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to university level study, find out more about the types of qualifications we offer, including our entry level Access courses and Certificates.

Not ready for University study then browse over 900 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus