1
00:00:11,240 --> 00:00:16,410
Okay, for this question-and-answer vlog I got a question from Remus.

2
00:00:16,860 --> 00:00:23,370
He asks, What is the use of giving a default gateway to a switch using the IP default gateway command?

3
00:00:33,570 --> 00:00:42,980
Okay Remus, here's the answer to the question. In this GNS3 topology I've got a router connected to a layer 3 switch which in turn is connected

4
00:00:43,010 --> 00:00:47,650
to a layer 2 switch, a layer 3 switch has IP routing enabled.

5
00:00:47,660 --> 00:00:53,870
In other words, it will route from VLAN 1 to VLAN 2 and back again, switch 2 is a layer 2 switch.

6
00:00:53,870 --> 00:00:56,560
In other words, it doesn't have IP routing enabled.

7
00:00:56,650 --> 00:01:06,920
So for the CCNA, this could be a 2950 switch or 2960 and this could be a 3750 or 3550 as

8
00:01:06,920 --> 00:01:08,140
an example.

9
00:01:08,150 --> 00:01:15,130
So on router 1, is router 1 able to ping switch 2? Answer is

10
00:01:15,130 --> 00:01:20,010
no, the router is not able to ping switch 2.

11
00:01:20,170 --> 00:01:22,920
What about trace and to speed things up I'm gonna type

12
00:01:22,930 --> 00:01:24,110
no IP domain

13
00:01:25,430 --> 00:01:31,500
look-up. So traceroute to 10.1.1.1

14
00:01:31,590 --> 00:01:39,540
Okay so the traffic gets to switch 1 so it goes from router 1 to switch 1 10.1.2.2

15
00:01:39,540 --> 00:01:40,300
54

16
00:01:40,530 --> 00:01:48,990
and then the trace fails. So can i ping 10.1.254?

17
00:01:49,030 --> 00:01:52,150
Yes, I can and I would have known that from the trace

18
00:01:52,510 --> 00:01:55,310
but what I like to do is check the following.

19
00:01:55,330 --> 00:01:59,180
Can router 1 ping this IP address on the other side

20
00:01:59,360 --> 00:02:00,470
on switch 1.

21
00:02:00,850 --> 00:02:01,790
Yes, it can.

22
00:02:02,080 --> 00:02:05,000
So that means that the problem is not here.

23
00:02:05,050 --> 00:02:13,210
The problem is somewhere on this side. So on switch, 1 can we ping switch 2?

24
00:02:13,300 --> 00:02:14,690
The answer is yes.

25
00:02:14,950 --> 00:02:22,930
On switch 2 can it ping switch 1 on VLAN 1?

26
00:02:22,990 --> 00:02:24,040
Yes it can.

27
00:02:24,280 --> 00:02:33,970
But can it ping across switch 1?  Remember 1 was able to ping this IP address in VLAN 1. So

28
00:02:34,020 --> 00:02:39,800
switch 1 is doing inter VLAN routing but can switch 2 ping switch 1 IP address in VLAN 2?

29
00:02:40,150 --> 00:02:47,690
and it looks like it can't this is a very typical scenario where

30
00:02:47,800 --> 00:02:54,890
you can't ping or telnet to a switch in a remote subnet.

31
00:02:54,920 --> 00:03:01,050
Now on the switch when we use the command show IP route notice no default gateway has been set.

32
00:03:01,080 --> 00:03:04,420
This means that IP writing has been disabled on the switch.

33
00:03:04,770 --> 00:03:13,840
So what I need to do is type IP default gateway and point the switch to its default gateway. So show

34
00:03:13,840 --> 00:03:14,690
IP route

35
00:03:15,460 --> 00:03:20,920
notice default gateway set I'll do that command again there's the default gateway.

36
00:03:20,920 --> 00:03:26,540
So on router 1 can we ping switch 2? Answer is yes.

37
00:03:26,560 --> 00:03:30,740
So you need to configure a default gateway on a layer 2 switch.

38
00:03:30,760 --> 00:03:36,580
In other words, a switch that hasn't got IP routing enabled to allow that switch to send traffic to remote

39
00:03:36,700 --> 00:03:43,900
subnets. Traffic from router 1 could get to switch 2 but won't be able to get back again if switch

40
00:03:43,900 --> 00:03:48,140
2 doesn't have a default gateway configured.

41
00:03:48,150 --> 00:03:53,680
Now, this can get confusing if the switch is a Layer 3 switch or supports Layer 3 functionality.

42
00:03:53,790 --> 00:04:01,080
Notice at the moment once again IP routing is disabled because we don't see a routing table here.

43
00:04:01,200 --> 00:04:06,520
Show run pipe include IP route

44
00:04:06,630 --> 00:04:07,500
Notice this command

45
00:04:07,520 --> 00:04:11,460
no IP routing, IP routing was disabled on this switch.

46
00:04:11,750 --> 00:04:13,960
That's a default on all the switches.

47
00:04:13,970 --> 00:04:19,200
So IP routing, let's enable that do the show IP route

48
00:04:19,200 --> 00:04:22,830
command again notice the output is very different.

49
00:04:22,830 --> 00:04:26,880
Notice also that the gateway of last resort is not set.

50
00:04:26,890 --> 00:04:38,600
So can router 1 ping switch 2? Answer is no, show run pipe include default.

51
00:04:38,830 --> 00:04:46,560
We still have the IP default gateway command configured on the switch but because IP routing is enabled

52
00:04:46,880 --> 00:04:49,050
that command is ignored.

53
00:04:49,050 --> 00:04:56,320
So you only use the IP default gateway command when IP routing is disabled. So let's do that again,

54
00:04:56,490 --> 00:04:58,110
No IP routing

55
00:05:01,160 --> 00:05:03,350
pings succeeds, IP routing

56
00:05:06,120 --> 00:05:07,700
ping fail.

57
00:05:08,010 --> 00:05:11,490
So an IP routing is enabled like this.

58
00:05:11,550 --> 00:05:19,750
What you need to do is you need to create a default route to your default gateway. So something like that

59
00:05:21,110 --> 00:05:24,260
and now routing works.

60
00:05:24,260 --> 00:05:31,360
So here's the thing to remember if IP routing is enabled on a switch you must use a static default route

61
00:05:31,520 --> 00:05:36,080
like this or run a routing protocol. If IP routing is disabled

62
00:05:36,080 --> 00:05:42,880
He used the IP default gateway command to allow a switch to send traffic to a remote subnet. Remus

63
00:05:42,890 --> 00:05:46,670
I'm hoping that answers your question and I hope that helps everyone else.

64
00:05:46,670 --> 00:05:49,400
Don't forget to ask questions in the comments below.

65
00:05:49,790 --> 00:05:53,380
Please also look at the video and please subscribe.

66
00:05:53,690 --> 00:05:55,520
I want to wish you all the very best.

