Good Evening,

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

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

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

That gives me a network address of
Host range of -
A broadcast address of

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

The IP address of the router is
The IP address of switch 1 is
The IP address of switch 2 is

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

Recommended Answers

All 9 Replies

Okay, so, some basics.

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

First, there's a shorthand for this: That means that using a base of (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, which denotes the network itself, and one where the free bits are all one (in this case, that would be, which denotes the network's broadcast address.

So you can't use 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 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.


Thanks, so if I'm understanding correctly, the network is and the router ip is 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

The subnet address for this range is
The host range is -
The directed broadcast is

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
Does this make the subnet for this range and the directed broadcast
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]
                                  +--> [Switch1] <--+--> [Host]
                                  |                 +--> [...]
                                  |                 `--> [Host]
                                  `--> [Switch2] <--+--> [Host]
                                                    +--> [...]
                                                    `--> [Host]

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]
                                  +--> [Switch1] <--+--> [Host]
                                  |                 +--> [...]
                                  |                 `--> [Host]
                                  `--> [Switch2] <--+--> [Host]
                                                    +--> [...]
                                                    `--> [Host]

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]::
                  [] []
                             ^        ^
                             |        `--> [Switch1] <--+--> [Host]
                             |                          +--> [...]
                             |                          `--> [Host]
                             `--> [Switch2] <--+--> [Host]
                                               +--> [...]
                                               `--> [Host]

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, and one for Is that basically what you want?

Yes, so the entire network will be

The router will be split into eight subnets

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 *correct or is it *Router(config-if)# ip address for subnet 1?

Lets say that we use - 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#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 vty 0 4
router1(config-line)#password cisco
router1(config)#service password-encryption
router1#copy running-config startup-config
Destination filename [startup-config]? 
Building configuration...
router1#show run
Building configuration...
Current configuration : 1308 bytes
[…  additional lines removed …  ]
line con 0
 password 7 070C285F4D06
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
 transport input all
scheduler allocate 20000 1000
router1#configure terminal
router1(config)#interface gigabitethernet 0/0
router1(config-if)#ip address
router1(config-if)#description switch1
router1(config-if)#no shutdown
*Dec  3 00:54:05.187: %LINK-3-
UPDOWN: Interface GigabitEthernet0/0, changed state to down
router1(config)#interface gigabitethernet 0/1
router1(config-if)#ip address
router1(config-if)#description switch2
router1(config-if)#no shutdown
*Dec  3 01:03:24.243: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
*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#copy startup-config running-config
Destination filename [running-config]? 
1308 bytes copied in 0.128 secs (10219 bytes/sec)


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:
** GW: GW: **

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 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 network, its gateway would be; for, its gateway would be, 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, learning, and sharing knowledge.