0

I am new to Cisco networking. I am trying out a simple Network. I connected 3 PCs to a Switch.

PC A --> VLAN 10  ip address of PC A 100.100.100.3
PC B --> VLAN 20  ip address of PC B 120.120.120.3
PC C --> VLAN 30  ip address of PC C 130.130.130.3

Now, I am hoping to telnet to the switch from PC C.

I opened the Switches CLI and typed;

>conf t
> int vlan 30
>ip address 192.168.4.56

When I tried to ping from PC C (which is ip 130.130.130.3). I get the following message (Which I believe is wrong)

Pinging 192.168.4.56 with 32 bytes of data:

Reply from 130.130.130.3: Destination host unreachable.
Reply from 130.130.130.3: Destination host unreachable.
Reply from 130.130.130.3: Destination host unreachable.

But, when I change the ip address on the switch to 130.130.130.5, and ping from PC C it works.

1.) Why is this ? (So is it because, we need to have it in the same network)

2.) I want to be able to PING from all the PCs (PC A, PC B and PC C). How can I do it ?

3 Answers 3

7

Each PC and corresponding VLAN interface must be in the same subnet. The PC will also need to have a default gateway set to point to the IP address of the switch.

You need to think about this from the perspective of routing tables. Nodes consult their routing table to figure out where to transmit data. Here's an example using /24 masks since you didn't specify the subnet masks above.

PC A: 100.100.100.3/24 (/24 means 255.255.255.0) without a default gateway set will have only a few entries in it's routing table. The first will be 100.100.100.3/32 since its on the machine itself, the other will 100.100.100.0/24. The PC interprets this to mean it doesn't have to go anywhere else to reach 100.100.100.1-254 it can reach those addresses on the interface you set the IP on. Now... once you add a default gateway (which must be on a network you are CONNECTED to), then you'll have an entry for 0.0.0.0 to 100.100.100.5.

To make your entire network function, this is how you'd do it:

PCs

PC A: 100.100.100.3/24 default gateway 100.100.100.5

PC B: 120.120.120.3/24 default gateway 120.120.120.5

PC C: 130.130.130.3/24 default gateway 130.130.130.5

SWITCH

VLAN10 IP: 100.100.100.5/24

VLAN20 IP: 120.120.120.5/24

VLAN30 IP: 130.130.130.5/24

The switch should not need a default gateway or any other routes set. If it's a Cisco switch, do not forget the command "ip routing" or the switch will not perform inter-vlan routing.

EDIT: Also, if it helps you comprehend a little better, someone once summed this up in a way that made everything click for me when I kept asking "why do we we need subnets". His simple answer was "So the damn routers know what to do!"

As a homework assignment, you should read and digest this information: How does IPv4 Subnetting Work?

0
1

In order to remotely manage a switch you will need the following configured.

Within the same subnet: (1) an Ip address (2) login and password on the vty lines

Outside the local subnet: (1) an Ip address (2) default GW (3) login and password on the vty lines

Now, when you attempt to login to the switch, what do you receive? If possible post the ping/trace and telnet login captures. Are you trying to connect from the router? From a PC within the same subnet or outside this subnet?

0

If you are unable to ping a switch from a remote host and you have made sure that your routers have routes to the different subnets in the network, then make sure that you configure the default gateway on your switches for the vlan interfaces, otherwise, you will not be able to ping the switch or have VTY access. This can be done by issuing the 'ip default-gateway A.B.C.D' command in global configuration mode on the respective switch. Your default gateway IP address should be the IP address of the router that services the subnet(s) on which the switch resides.

1
  • he doesn't have a default gateway. He has 1 switch and 3 PCs. May 21, 2018 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .