Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple question - switches & default gateways

Posted on 2004-08-21
5
Medium Priority
?
407 Views
Last Modified: 2010-04-11
This should be a simple one guys...but I seem to be getting myself confused.

What is the purpose of setting a Layer 3 gateway address on a Layer 2 switch (using the ip default-gateway command)?

Scenario: A PC connected to a L2 switch (eg 1900, 2950) sends a frame to a PC on another subnet. Lets assume there is full connectivity between the 2 devices (pings OK). I know that the local routing table is checked (on the PC), nothing found locally so the frame is sent to the PC's default gateway (which would be the router). All cool...except here is where I am over-complicating things I think:

Before the packet even gets to the router it must go through the switch - when the frame gets to the switch port, I thought the switch would check its CAM table (this is the MAC addresstable yes?) for the routers MAC address and forward the frame out the correct port (assuming the router was directly connected OR the routers MAC address was learnt via a routing protocol).

1. Is this procedure correct? If so, when does the default gateway of the switch come into play?

2. When setting the switch's default gateway address, would it have to be the same as the PCs?

Thanks,

Alsace.
0
Comment
Question by:alsace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:scampgb
ID: 11858947
Hi alsace,

Your understanding is pretty accurate, but I can see where you become confused.

In this environment, the switch doesn't do any routing at all - it just plays nicely at level 2 and shuffles packets between its interfaces based on MAC address.
To this extent, your understanding is correct.

However, the router in question also has an IP address.  It has an IP address so that you can configure, manage and monitor it.
All that's well and good if the PC you're using to configure it is on the same IP subnet as the switch.  However, that would not always be the case, in which case the switch has a default gateway.

Essentially, the switch doesn't use it's IP address or default gateway for the purposes of being a switch (layer 2).  However, it does need them for you to manage the switch.

Does that make sense?
0
 

Author Comment

by:alsace
ID: 11859277
I think so scampgb... thanks for the reply... you have cleared up the IP address query.("However, the router in question also has an IP address.  It has an IP address so that you can configure, manage and monitor it."). Did you mean to say the 'switch' in question?

If so, I understand that it has a layer 3 address for management reasons, but still struggling to see how a switch can use a default gateway, unless it was for unresolved addresses that the switch ITSELF was trying to resolve... is that right?

This is from the Cisco website (how to configure the ip default-gateway address on a 2950): "Enter the IP address of the next-hop router interface that is directly connected to the switch where a default gateway is being configured. The default gateway receives IP packets with unresolved destination IP addresses from the switch. Once the default gateway is configured, the switch has connectivity to the remote networks with which a host needs to communicate. Note When your switch is configured to route with IP, it does not need to have a default gateway set."

So would it be fair to say that the switch would use it's default gateway if, for example, I telenetted into it (or used the console) and pinged another host on another IP subnet from that session? That is, I was using the switch for some layer 3 functions when I was managing the switch?

Thanks again,

Alsace.
0
 
LVL 15

Accepted Solution

by:
scampgb earned 500 total points
ID: 11859309
Hi Alsace - well spotted! I did indeed mean to type "switch"

OK, it's important to understand the differences between Layers 2 & 3.

A switch operates at layer 2.  It's job is to get ethernet frames from one place to another, and switches by MAC addresses.
If it doesn't know where a MAC address is, the IP default gateway doesn't come into it at all.
If it can't find it, then it broadcasts and layer 2 out of all of its ports, and hopes that it gets a response.

IP is a layer 3 protocol.  The switch understands it for the purposes of management.  As you rightly point out, many switches are more intelligent than that and will allow you to do pings and traceroutes.
If you've telnetted to the router, and asked it to ping something that is not on it's subnet, it will direct the IP packets to it's default gateway in the same way that any other device (PC, printer) would.

As for the stuff from Cisco's website, that further complicates matters :-)  
When it says "unresolved destination IP addresses", it really is talking about it's own layer 3 IP communication.  Unresolved in this case means it doens't know how to route to it.
It is possible to configure a switch (layer 2) to perform some of the functions of a router (layer 3).  This is a whole other area though!

Does that help?
0
 

Author Comment

by:alsace
ID: 11861536
Yep - perfectly.

To summarize I think I am getting the switches MANAGEMENT functions (layer 3) confused with it's SWITCHING functions (Layer 2).

Thanks again scampgb.

Alsace
0
 
LVL 15

Expert Comment

by:scampgb
ID: 11863247
Hi Alsace.  Thanks for the "A".  Glad I could help.

Your summary is absolutely perfect :-)
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question