Question regarding default gateway

r0arshach

Distinguished
Aug 29, 2011
28
0
18,530
I'm just curious about the DG hosts would use on a simple network. Say Im configuring a basic Linksys router, and I enter the following Ip's.

WAN IP: 192.168.1.2
255.255.255.0
DG: 192.168.1.1

LAN IP: 192.168.0.1
255.255.255.0



And say I hook up 2 host computers on the LAN, with the IP's 192.168.0.5, and 192.168.0.6. Will their default gateways be 192.168.0.1, or 192.168.1.1?

If they use 192.168.0.1, then what is the WAN DG (192.168.1.1) used for? Does that mean there are 2 default gateways per router (internal and external)?

Thanks for any help.
 

RealBeast

Titan
Moderator
The WAN address will be assigned by your ISP unless you are just making a subnet from your main router. That is the address of your actual Internet connection and will only be a 192.x.x.x address if your connection is through somebody else doing NAT -- like a landlord with a router that divides up his ISP service to the tenants.

If you have machines on the LAN of 192.168.0.1 they can either automatically obtain an IP which will be in the 192.168.0.x range or you can give them static addresses in that same range. 192.168.1.x is a different network that cannot be accessed from 192.168.0.x machines, i.e. in a /24 network (subnet mask 255.255.255.0) the third octet defines the network and the fourth defines the devices on that network.

If your connection is through an ISP, cable or DSL, set the WAN to be automatically obtained unless you have a static address from your provider, which is uncommon for residential users. Then set the LAN to 192.168.x.1 and x can be from 0 to 254 -- the most common are 0 or 1. Set all of your computers to automatically obtain an IP address from the gateway, which is your router at 192.168.0.1. You usually only need to make static addresses for devices like printers. If you do want to use a static address, you will need to configure that address in both the networked computer and the router.
 

r0arshach

Distinguished
Aug 29, 2011
28
0
18,530


I understand all that. I know that Id be using DHCP if I was just connecting to the ISP. This is for a networking class at school, and I know how to build the whole LAN portion of the network. Im just curious as to what the DG of the WAN portion of the router (192.168.1.1 in this example) would be used for, if all the hosts on the LAN have the DG of 192.168.0.1?
 

RealBeast

Titan
Moderator
You could have one single router with an actual Internet connection, say it has a gateway LAN address of 192.168.0.1 that connects to a bunch of other routers, 192.168.x.1 where x is from 1 to 254, and each of those subnets would have their own devices on their particular network, as defined by the third octet, the third value of the four set apart by the periods.
 

john-b691

Honorable
Sep 29, 2012
703
1
11,160
You have to remember at what point in the network you are looking at things from.

When the packet is in the PC his default gateway will be your local router....it is the only router he can talk to. Now when your router gets the packet it too needs know where to send it. The router itself has a default route that tell it to send it to the ISP router.

The confusing part is that the router is acting as the DHCP server for the PC. Part of the DHCP configuration is to tell the PC what its default route is. The key here to remember is this default route for the PC in the DHCP configuration not the routers default route. Now you would think you could just give the PC the same default route the router uses and it would be simple. The purpose of the default gateway is to indicate the device that has the path out of the subnet. Since the default route the router uses is on the WAN subnet it is already outside the LAN subnet. How does the pc use this address to get outside if your do not know how to get to it in the first place. This means your default route must be a address you know how to get to which mean it must reside on the same subnet.