PC are connected together on a Local Area Network normally Ethernet cables into a switch. Each PC has a IP address consisting of a network number and a host number. So if your PC are 192.168.1.1 and 192.168.1.2 ....
then 192.168.1 is the network and .1 and .2 are the host numbers.
If they want to go to the Internet you need a Gateway (Router). This Gateway will have an address such as 192.168.1.254.
So if you want to get to the Internet you send things to the default gateway 192.168.1.254.
Normally when you switch on your PC it issues a general request which says please give me my IP address and tell me the default gateway and other thing. All PC on the LAN sees the request but the Gateway say I will find a free IP number for you and tell you the default-gateway.
If you need to explicity state the default gateway you code it on the PC using the Windows route command
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.1.254 METRIC 3
destination^ ^mask gateway metric ^
This says to get to any network go to Gateway 188.8.131.52 which must be on your LAN.
route print shows the value.
Above is a very simple introduction because it is quite a big subject.
As always thanks!! It kind of makes sense.....what is the purpose for a gateway? Just routing of IP address that are not permanent?
I have the Cisco Press books for CCENT/CCNA ICND1/ICND2, and I also have the Exam Cram for CCENT. Is there any chapters or pages in there you can direct me to for reading?
Is this part of the CCENT test? the reason I ask is Ive read the first Cisco book and dont remember coming across that?
It is for any address that is not on your local area network.
I am sorry I know nothing about the new Cisco exams it all changed a while ago.
Im going to read up on it regardless (it has struck an interest). Do you know where in the books mentioned above I can find this info?
Thanks again Conwyn!
I think for me the best way I understood the concept was while applying it to my home network.
At home I assume you have a Cable/DSL modem/router - the internal IP address of this device would be the default gateway for your PC.
So, if your PC was trying to request www.cisco.com if would resolve the cisco.com domain to an IP address. Then, your computer would realize that this IP address is not on the local network and so the request would be forwarded out into the big world through your router (default gateway).
While researching the topic of a DEFAULT GATEWAY also research DEFAULT ROUTE (IE. DEFAULT NETWORK) and STATIC ROUTE! They all provide similar functionality but are indeed different.. Takes a while to grasp the differences so don't fret!
Here are some links that may be of interest for all three!!!
Default Route VS Static Route
Default Gateway VS Static Route (On a layer 2 switch) Just know that on a Cisco/HP and most other switches you have to use a static route to forward (Default Gateway will not work!)
The Cisco Explanation:
Finally, How routers work from How Stuff Works website!!! Read this in it's entirety!!!
I hope this helps!
Hi Billy and Raven
Just to clarify the default-gateway on a L2 switch. This always causes confusion.
A L2 switch has a management address called VLAN 1. If you add a new VLAN x then VLAN 1 disappears. So you can only have one what ever you call it. This VLAN 1 has an IP address so you can logon onto the switch to manage it. Now if you come from a distant network you need a route to get back. The L2 switch has a default-gateway which must point to a L3 device such as a router. So you can ping all the other devices with similar IP address but if the target of the ping is not within the local network then it sends the traffic to the named default-gateway. Note you have to fully type show default-gateway because it is a hidden command. Ordinary data entering the switch on one of the port simply passes through the switch. It is not routed.
I hope that is a fair explaination. Scott to clarify.
That is pretty much what the post I referenced is referring to with the exception that they claim it to be necessary to use a static route as opposed to the default-gateway command on an L2 switch with multiple VLANs.. Not applicable to an L3 model which will properly utilize the ip default-gateway command.. Follow the link and let me know what you think! I will read it more thoroughly and follow up!
It is a L2 2950 switch.
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA6, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Look no routing
root#show ip route
% Invalid input detected at '^' marker.
Let us set a default-gateway
Enter configuration commands, one per line. End with CNTL/Z.
root(config)#ip default-gateway 184.108.40.206
Let us try pinging something which is not on 220.127.116.11
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.6, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/8 ms
So how did we get there?
Type escape sequence to abort.
Tracing the route to 10.0.0.6
1 18.104.22.168 0 msec 0 msec 0 msec (default-gateway address)
2 10.0.0.6 4 msec 0 msec * ( a distant router)
root#show ip default-gateway
What is our management address from show run
ip address 22.214.171.124 255.255.255.0
no ip route-cache
ip default-gateway 126.96.36.199
Do me a favor.. Take my last post and completely reverse it.. LoL
L2 Switch or L3 with No Routing enabled = ip default-gateway
L3 Switch with Routing enabled = ip route
I had to read my post twice to grasp the extent of dyslexia involved.. LoL
It's all in the link I posted before dyslexia kicked in.. Thanks for the help!