Options

What is the main purpose of a default gateway?

sizeonsizeon Member Posts: 321
read topic

Comments

  • Options
    hiddenknight821hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□
    So that if a gateway (usually a router) has a route for a packet that needs to be sent outside of its network so that it can reach its destination through multiple routes (assuming each hop or router has a route for the packet). You don't need a gateway if you are communicating within the network. You can't communicate with the outside network without a gateway. Trust me. There is no way to get around this. :D
  • Options
    SteveO86SteveO86 Member Posts: 1,423
    I like to think of the default gateway as the following:

    If the router looks in it's routing table and doesn't know where exactly to send the packet it goes out the default gateway. Meaning there is no existing entry in the routing table that is either exactly or less specifically pointing to the packets destination it goes out the default gateway (or gateway of last resort)

    As hiddenknight821 said it's primary purpose is to get packets off the subnet, or out to the internet.
    My Networking blog
    Latest blog post: Let's review EIGRP Named Mode
    Currently Studying: CCNP: Wireless - IUWMS
  • Options
    MrBrianMrBrian Member Posts: 520
    A default-gateway is used for devices that can't do IP routing.. You'll see your default gateway if you do an ipconfig or ifconfig on your host machines. This way if the host has a packet it wants to send to a network that is not on it's subnet, it can get it to the gateway(router), and hope they have a path for it. Also, the "ip default-gateway" command is used on a switch.. so if you telnet to the switch from a distant network, the packets will find their way back.

    The "ip default-gateway" command won't work on a router though. Routers use the concept of "gateway of last resort," which you can set with various commands.. so when the router gets a packet it needs to send, but doesn't have a specific router for it, it will be sent to the gateway of last resort.. I guess you could call this the router's default gateway, but since there's an "ip default-gateway" command that can't be used on a router, it could cause confusion.

    So if you want to set the gateway of last resort on a router there are a couple ways to do this.. you can set a static default route like "ip route 0.0.0.0 0.0.0.0....." or you could use the "ip default-network" command, which points to a classful network that has to be in the routing table for it to work. Hopefully I didn't blur things, but the question was kinda vague lol. Basically, a default gateway is an address a device will use to send packets to when it doesn't know where to send them itself.

    It's like when two little kids are fighting at home and they can't solve the problem.. so they run to their dad.. and their dad doesn't know what to say so he's like uhh.. go see your mother, she'll know what to do (hopefully). OK that may have been the worst analogies ever made, but you get the gist
    Currently reading: Internet Routing Architectures by Halabi
Sign In or Register to comment.