Good Evening,

I just can't seem to wrap my head around this IP addressing.

Lets say I want to use 192.168.1.0 default gateway.
Then
Router IP Address = 192.168.1.0

Lets say my subnet mask is 255.255.255.224 = 32 IP addresses and 30 hosts.
That makes my first line out g0/0 from the router to switch1
ip address 192.168.1.1 255.255.255.224

That gives me a network address of 192.168.1.1
Host range of 192.168.1.2 - 192.168.1.31
A broadcast address of 192.168.1.32

Lets make G0/1 from router to switch2
ip address 192.168.1.33 255.255.255.224
That gives me a network address of 192.168.1.33
a host range from 192.168.1.34 - 192.168.1.63
and a broadcast range on 192.168.1.64

The IP address of the router is 192.168.1.0
The IP address of switch 1 is 192.168.1.1
The IP address of switch 2 is 192.168.1.33

So why doesn't this look right? I can't quite figure it out.

Okay, so, some basics.

You said your subnet mask is 255.255.255.224. From the rest of the discussion, you want a network encompassing 192.168.1.0 – 192.168.1.31, yes?

First, there's a shorthand for this: 192.168.1.0/27. That means that using a base of 192.168.1.0 (or 11000000.10101000.00000001.00000000 in binary), the first 27 bits are fixed (leaving the last five free to vary, and five bits results in 32 combinations).

The thing is, for every network, there are two reserved addresses: one where the free bits are all zero (in this case, that would be 192.168.1.0), which denotes the network itself, and one where the free bits are all one (in this case, that would be 192.168.1.31), which denotes the network's broadcast address.

So you can't use 192.168.1.0 as the default gateway, because it's reserved to represent the network itself. Usually, the convention is to use 1, so your default gateway should be set to 192.168.1.1. That leaves the rest of your hosts on that network in the range 2–30.

Switches don't typically occupy an IP address; they're pretty basic network devices that don't really have a need for an IP address.

Does that help a little? I suspect you might have more questions.

mcglk,

Thanks, so if I'm understanding correctly, the network is 192.168.1.0 and the router ip is 192.168.1.1 which is also the default gateway.

So when I configure the first g0/0 port on the router, it will be

Router(config-if)# ip address 192.168.1.2 255.255.255.224

The subnet address for this range is 192.168.1.2
The host range is 192.168.1.3 - 192.168.1.32
The directed broadcast is 192.168.1.33

This leaves my next range of addresses to start at 34 or exactly 2+32.

Does this look correct?

Edit: I think what I'm having difficulty grasping is exactly what the command on the router does to configure the ports on the router.
To make this easier, if I use Router(config-if)# ip address 192.168.1.32 255.255.255.224
Does this make the subnet for this range 192.168.1.32 and the directed broadcast 192.168.1.63?
If dealing with the Subnet 0 range, or the 0-32 range, wouldn't the subnet need to be shifted to start at .2 to account for the .0 network reserved address and the .1 default gateway address?

I'm a little confused about your network topology. Is the router operating as your gateway?

Here's what I envisioned from your original message:

((Internet)) <-> [Gateway/Router 192.168.1.1/27]
                                  ^
                                  +--> [Switch1] <--+--> [Host 192.168.1.2/27]
                                  |                 +--> [...]
                                  |                 `--> [Host 192.168.1.30/27]
                                  `--> [Switch2] <--+--> [Host 192.168.1.33/27]
                                                    +--> [...]
                                                    `--> [Host 192.168.1.62/27]

Except you wanted "Switch2" to serve a different set of addresses. That means your router doesn't have enough addresses to accommodate it; you're going to have to switch to a larger network:

((Internet)) <-> [Gateway/Router 192.168.1.1/26]
                                  ^
                                  +--> [Switch1] <--+--> [Host 192.168.1.2/27]
                                  |                 +--> [...]
                                  |                 `--> [Host 192.168.1.30/27]
                                  `--> [Switch2] <--+--> [Host 192.168.32.33/27]
                                                    +--> [...]
                                                    `--> [Host 192.168.32.62/27]

The switches would then isolate the internal traffic on each /27 network, but pass any external traffic. The router would see all the traffic passing between the switches, but only handle traffic between the LAN and the Internet.

But perhaps I'm misunderstanding. Do you actually want two entirely separate networks for Switch1 and Switch2? (By which I mean, isolated from each other by the router?)

(And actually, I see I did misunderstand your original post, so I'll follow this up.)

So as I said, I misunderstood your original post. What you want is more like this:

((Internet)) <-> [Gateway/Router]::
                  [192.168.1.33/27] [192.168.1.1/27]
                             ^        ^
                             |        `--> [Switch1] <--+--> [Host 192.168.1.2/27]
                             |                          +--> [...]
                             |                          `--> [Host 192.168.1.30/27]
                             `--> [Switch2] <--+--> [Host 192.168.1.34/27]
                                               +--> [...]
                                               `--> [Host 192.168.1.62/27]

It gets awkward trying to represent these in ASCII, so I apologize for that. (I wish DaniWeb had some sort of image storage we could upload to and link to for these sorts of discussions.)

But basically, your router has three interface cards: one for the Internet, one for 192.168.1.0/27, and one for 192.168.1.32/27. Is that basically what you want?

Yes, so the entire network will be 192.168.1.0

The router will be split into eight subnets
192.168.1.0/27
192.168.1.32/27
192.168.1.64/27
192.168.1.96/27
192.168.1.128/27
192.168.1.160/27
192.168.1.192/27
192.168.1.224/27

The first two subnets will be used, the remaining will be reserved for whatever we may need them for in the future. So the network will look like this:
Network Diagram

What's the IP address of the router? Is the default gateway different for each switch? And what does the configuration script look like?
Is Router(config-if)# ip address 192.168.1.2 255.255.255.224 *correct or is it *Router(config-if)# ip address 192.168.1.1 255.255.255.224 for subnet 1?

Lets say that we use 192.168.1.2 255.255.255.224 - what is the default gateway? That's where I'm getting stuck.

So here's what I've got for the router - it seemed to work without giving any errors. I'll just need to check to see what the switch configuration needs to be and then test end to end connectivity between the work stations when done. I think this configuration script matches the router in the diagram.

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname router1
router1(config)#enable secret class
router1(config)#line console 0
router1(config-line)#password cisco
router1(config-line)#login
router1(config-line)#exit
router1(config)#line vty 0 4
router1(config-line)#password cisco
router1(config-line)#login
router1(config-line)#exit
router1(config)#service password-encryption
router1(config)#exit
router1#copy running-config startup-config
Destination filename [startup-config]? 
Building configuration...
[OK]
router1#show run
Building configuration...
Current configuration : 1308 bytes
[…  additional lines removed …  ]
line con 0
 password 7 070C285F4D06
 login
line aux 0
line 2
 no activation-character
 no exec
 transport preferred none
 transport output lat pad telnet rlogin lapb-ta mop udptn v120 ssh
 stopbits 1
line vty 0 4
 password 7 0822455D0A16
 login
 transport input all
!
scheduler allocate 20000 1000
!
end       
router1#configure terminal
router1(config)#interface gigabitethernet 0/0
router1(config-if)#ip address 192.168.1.1 255.255.255.224
router1(config-if)#description switch1
router1(config-if)#no shutdown
router1(config-if)#
*Dec  3 00:54:05.187: %LINK-3-
UPDOWN: Interface GigabitEthernet0/0, changed state to down
router1(config-if)#exit
router1(config)#interface gigabitethernet 0/1
router1(config-if)#ip address 192.168.1.33 255.255.255.224
router1(config-if)#description switch2
router1(config-if)#no shutdown
router1(config-if)#
*Dec  3 01:03:24.243: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
router1(config-if)#
*Dec  3 01:03:27.543: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
*Dec  3 01:03:28.543: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
router1(config-if)#exit
router1#copy startup-config running-config
Destination filename [running-config]? 
1308 bytes copied in 0.128 secs (10219 bytes/sec)

router1#

There is usually 1 gateway per subnet.

When a machine wants to communicate with an IP address that does not reside in a directly connected subnet (an ip outside it's subnet), then the traffic is sent to the default gateway. The GW must be in the same subnet as the machine since the traffic is sent via layer 2 to the GW mac address.

So, each of your subnets would have 1 gateway:
**192.168.1.0/27 GW: 192.168.1.1
192.168.1.32/27 GW: 192.168.1.33 **

Gateways are assigned to machines in the subnet via DHCP or statically within the network config.

Now on the router, the concept is pretty much the same.
Run 'SHOW IP ROUTE" to see the current routing table.

There would be a 'C' for each directly connected subnet. The gateway of the router is the 'Gateway of last resort" with can also be identified as a route for destination 0.0.0.0/0. The gateway for these is, essentially, your router's default gateway..... that is the device for the traffic that does not fall within any other location in the routing table. This GW is usually your ISP's router IP. You would need to setup 1 interface for the ISP router network.

CimmarinX has it right; each subnet would have its own gateway (on the subnet) with its own IP address. The usual convention is that this is host 1 (for example, for the 192.168.1.32/27 network, its gateway would be 192.168.1.33; for 192.168.1.192/27, its gateway would be 192.168.1.193, etc.).

Now, I admit that it's been quite a while since I've had to configure a Cisco router (like, 15 years—eek). But your configuration commands (lines 42–end) look appropriate. In effect, each internal network interface will get its own address that represents that subnet's gateway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.