0

I’m a little embarrassed to be asking this but here goes.

In a training video for CCENT, I see a switch connected to 2 PCs that are pinging each other on the same subnet. I try to replicate the setup with 2 Linux PCs and the PCs cannot ping each other.

After quite a bit of diagnosing I come up with the reason that they are not pinging each other, is because initially PC1 does not know PC2’s MAC address and because the switch is a Layer 2 device, it cannot forward the frame. Once I add a router to the topology and tell the PCs to use it as the default gateway, the PCs can reach each other.

My question is, are my assumptions correct? or is there a way to configure either my L2 switch (Cisco 2960) or my PCs to ping each other without an additional router? I am really curious to know how the instructor did it in the video, but at this point can only surmise that the Windows PCs he is using are helping with the ARP somehow that my Linux PC doesn’t.

Edit: adding configs

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Switch#show ip int brief
Interface              IP-Address      OK? Method Status                Protocol
Vlan1                  10.3.1.1        YES NVRAM  up                    up      
FastEthernet0/1        unassigned      YES unset  up                    up      
FastEthernet0/2        unassigned      YES unset  down                  down    
FastEthernet0/3        unassigned      YES unset  down                  down    
FastEthernet0/4        unassigned      YES unset  down                  down    
FastEthernet0/5        unassigned      YES unset  down                  down    
FastEthernet0/6        unassigned      YES unset  down                  down    
FastEthernet0/7        unassigned      YES unset  down                  down    
FastEthernet0/8        unassigned      YES unset  down                  down    
FastEthernet0/9        unassigned      YES unset  down                  down    
FastEthernet0/10       unassigned      YES unset  down                  down    
FastEthernet0/11       unassigned      YES unset  down                  down    
FastEthernet0/12       unassigned      YES unset  down                  down    
FastEthernet0/13       unassigned      YES unset  down                  down    
FastEthernet0/14       unassigned      YES unset  down                  down    
FastEthernet0/15       unassigned      YES unset  down                  down    
FastEthernet0/16       unassigned      YES unset  down                  down    
FastEthernet0/17       unassigned      YES unset  down                  down    
FastEthernet0/18       unassigned      YES unset  down                  down    
FastEthernet0/19       unassigned      YES unset  down                  down    
FastEthernet0/20       unassigned      YES unset  down                  down    

Switch#show int vlan 1
Vlan1 is up, line protocol is up 
  Hardware is EtherSVI, address is 0025.8347.d4c0 (bia 0025.8347.d4c0)
  Internet address is 10.3.1.1/24
  MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive not supported 
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:01, output 03:07:32, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     7073 packets input, 586827 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     1 packets output, 64 bytes, 0 underruns
     0 output errors, 2 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out
Switch#

And Linux PC

bob bob # ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp9s0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:21:70:b7:c6:9c brd ff:ff:ff:ff:ff:ff
    inet 10.3.1.50/32 scope global enp9s0
       valid_lft forever preferred_lft forever
    inet6 fe80::221:70ff:feb7:c69c/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:22:5f:1e:4e:e6 brd ff:ff:ff:ff:ff:ff
bob bob #

running-config

Switch#show run
Building configuration...

Current configuration : 2855 bytes
!
version 15.0
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
system mtu routing 1500
!
!
!
!
crypto pki trustpoint TP-self-signed-2202522752
 enrollment selfsigned
 subject-name cn=IOS-Self-Signed-Certificate-2202522752
 revocation-check none
 rsakeypair TP-self-signed-2202522752
!
!
crypto pki certificate chain TP-self-signed-2202522752
 certificate self-signed 01
  3082022B 30820194 A0030201 02020101 300D0609 2A864886 F70D0101 05050030 
  31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274 
  69666963 6174652D 32323032 35323237 3532301E 170D3933 30333031 30303031 
  30365A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649 
  4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D32 32303235 
  32323735 3230819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281 
  8100E4DB 6BDBD2DC 37055DFA 282999AE B96FC640 2241FF8A 430ED5FF A6017E03 
  F6B19437 AA7BE507 13CE0C75 679C17C0 32FBE9E3 7AD23E1B 25BEEF58 73A2C55F 
  A7156C6A ECCF31EF 537EC8AC 596AB7A5 71C29EEA 217D8DE4 95B8D7F1 47FF5381 
  986C93D6 D82C6734 1DE12C83 770EA60B 498A8D75 B9A1AAC6 A999B598 1E5E3081 
  C1530203 010001A3 53305130 0F060355 1D130101 FF040530 030101FF 301F0603 
  551D2304 18301680 141B3F0D 0506EF36 1F18AC79 78C722FD 82ADC5A4 BA301D06 
  03551D0E 04160414 1B3F0D05 06EF361F 18AC7978 C722FD82 ADC5A4BA 300D0609 
  2A864886 F70D0101 05050003 8181000A E3F3216C 34E27078 0FD09863 A1FC8958 
  EA67A0E9 0B1B26F4 CC675FEC 4C43B23A AA3CB113 973BD666 F5DFF4E9 B5C6372F 
  C1D0B75F CFF7EEA4 CBCBE18E A633BB8A B59841BC 4711FE62 945A1276 0CD80044 
  F0D34DDD BA3B346B EC97238C 479D686F 9EC88F50 9A5E786F D8DD023D 5142C4D1 
  3EED7955 AFBB2A10 DF839E02 0CE192
    quit
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!         
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface Vlan1
 ip address 10.3.1.1 255.255.255.0
 no ip route-cache
!
ip http server
ip http secure-server
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
line vty 0 4
 login
line vty 5 15
 login
!
end

Switch#
  • 1
    If the two ports are in the same VLAN and the two PC's have IP addresses in the same network, this should work without a router. So please provide configurations, at this moment your assumptions are not making much sense. – Teun Vink Mar 3 '18 at 22:28
  • 2
    If you have to configure the default gateway then the PCs are probably not on the same subnet. – Ron Trunk Mar 3 '18 at 22:53
  • You need to edit the question to give us the switch model and configuration. Do not forget to explain on which switch interfaces the PCs are connected. – Ron Maupin Mar 3 '18 at 23:49
  • You only have one interface up, so how do you have two PCs connected? You should include the full configuration from the show running-config command. – Ron Maupin Mar 4 '18 at 3:55
  • My bad, it took a couple of seconds for the other interface to come up. I'll put the running config. – not0x01 Mar 4 '18 at 4:01
2

The problem is with this:

2: enp9s0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:21:70:b7:c6:9c brd ff:ff:ff:ff:ff:ff
    inet 10.3.1.50/32 scope global enp9s0
       valid_lft forever preferred_lft forever

Because you didn't specify a network mask, the address was given a host-only /32 (255.255.255.255) mask. No other hosts belong to the network, therefore any attempts to ping an address will fail (check ip route to verify.)

The reason why ip route add 10.3.1.51 worked (from your answer) is because you added another host-only route, so your routes are this now:

127.0.0.1/8 via lo
10.3.1.50/32 via enp9s0
10.3.1.51/32 via enp9s0

Only these two addresses (and the loopback addresses) will work because they're the only ones that you have said exist!

You'll need both hosts to share a common network, or have some sort of route between them, before they will be able to see each other. In this case, try

# ip addr add 10.3.1.50/24 dev enp9s0
  • Ah, that make sense! Thanks for the detailed answer. I originally thought I could set the subnet mask through adding a route, so I had add route 10.3.1.0/24 via 10.3.1.1 Now it is clear that I had a host only network. – not0x01 Mar 4 '18 at 12:15
1

If you had a factory reset switch, and two computers with addresses PC1 10.0.0.1/24 and PC2 10.0.0.2/24 they'll be able to ping each other by IP address.

If they can't, there are plenty of exotic configurations which might prevent it, but as well start with the easy ones.

  • Check the addresses and netmasks actually are in the same subnet
  • Try an ether-swapover cable directly PC1-PC2 (or a straight cable if your PCs are auto-crossover, as most are these days)
  • Check none of the interfaces on the switch are down
  • If you've got any VLANs configured on your switch, make sure the interfaces for PC1 and PC2 are on the same VLAN.

Hope that's helpful.

-2

I think I figured it out. Next time I'll try and post more detail before hand. Thanks for the suggestions. It is helpful to know I should not need a router to ping devices on the same subnet.

My Linux PC needs to have a route before it can ping another device, and originally I tried the default gateway of the Switch, which caused the ping to hang.

These are the commands I ran to ping another Linux device through the Cisco Switch:

bob bob # ip link set enp9s0 down
bob bob # ip addr add 10.3.1.50
Not enough information: "dev" argument is required.
bob bob # ip addr add 10.3.1.50 dev enp9s0
bob bob # ip link set enp9s0 up
bob bob # ip route
bob bob # ping 10.3.1.51
connect: Network is unreachable
bob bob # ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp9s0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:21:70:b7:c6:9c brd ff:ff:ff:ff:ff:ff
    inet 10.3.1.50/32 scope global enp9s0
       valid_lft forever preferred_lft forever
    inet6 fe80::221:70ff:feb7:c69c/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:22:5f:1e:4e:e6 brd ff:ff:ff:ff:ff:ff
bob bob # ip route
bob bob # ping 10.3.1.51
connect: Network is unreachable
bob bob # ip route add 10.3.1.51
RTNETLINK answers: No such device
bob bob # ip route add 10.3.1.51 dev enp9s0
bob bob # ping 10.3.1.51
PING 10.3.1.51 (10.3.1.51) 56(84) bytes of data.
64 bytes from 10.3.1.51: icmp_seq=1 ttl=64 time=0.903 ms
64 bytes from 10.3.1.51: icmp_seq=2 ttl=64 time=0.538 ms

....
bob bob # ip neigh
10.3.1.51 dev enp9s0 lladdr b8:27:eb:5b:e3:e9 STALE
bob bob #

And now I know a little more about broadcast :)

  • 1
    Nope, you do not need a route. Your real issue is that your IP subnet mask is wrong. You have configured enp9s0 with a /32 mask (i.e. 255.255.255.255), which means that the peer's IP address 10.3.1.51 is considered to be on a different subnet, which is why you need the "ip route". If you configured both IP addresses with a /24 (i.e. 255.255.255.0) subnet mask, you wouldn't need it. I'm afraid I have to downvote your answer so that other users don't get misguided. – mere3ortal Mar 4 '18 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.