Switch Control

From JCWiki
Jump to navigation Jump to search

Manuals

3750 reference http://www.cisco.com/en/US/products/hw/switches/ps5023/products_command_reference_chapter09186a00801f5ffb.html#2789851

Finding which IPs are on a port

If you need to find out which IPs are on a particular port, start by finding out what mac addresses are on which port:

switch-p1> en
switch-p1#show mac-address-table
Dynamic Address Count:                 53
Secure Address (User-defined) Count:   0
Static Address (User-defined) Count:   0
System Self Address Count:             48
Total MAC addresses:                   101
Maximum MAC addresses:                 2048
Non-static Address Table:
Destination Address  Address Type  VLAN  Destination Port
-------------------  ------------  ----  --------------------
0002.b315.3201       Dynamic          1  FastEthernet0/8
0002.b3a6.f354       Dynamic          1  FastEthernet0/1
0002.b3bb.45fe       Dynamic          1  FastEthernet0/7
0002.b3e9.226b       Dynamic          1  FastEthernet0/4
0002.b3e9.868c       Dynamic          1  FastEthernet0/13
0002.b9b1.4c01       Dynamic          1  FastEthernet0/24
0004.75a1.91f1       Dynamic          1  FastEthernet0/24
0006.5b3d.80fb       Dynamic          1  FastEthernet0/1
0006.d78a.c798       Dynamic          1  FastEthernet0/1
0007.e90d.e4c9       Dynamic          1  FastEthernet0/24
0007.e95b.c645       Dynamic          1  FastEthernet0/1
000c.f1d3.a7f9       Dynamic          1  FastEthernet0/1
000c.f1dc.f1ce       Dynamic          1  FastEthernet0/3
000c.f1fa.71d7       Dynamic          1  FastEthernet0/24
000d.56fe.ad72       Dynamic          1  FastEthernet0/24
000e.0c59.c1a6       Dynamic          3  FastEthernet0/22
000f.1f64.43bc       Dynamic          1  FastEthernet0/24
0010.e002.473b       Dynamic          1  FastEthernet0/24
0011.0924.1d91       Dynamic          1  FastEthernet0/15
0011.1108.58a6       Dynamic          1  FastEthernet0/24
0011.1119.791e       Dynamic          1  FastEthernet0/24
0020.ed91.f85d       Dynamic          1  FastEthernet0/1
0030.4828.9d50       Dynamic          1  FastEthernet0/1
0030.4841.5246       Dynamic          1  FastEthernet0/5
0030.4870.8332       Dynamic          1  FastEthernet0/1
0030.4870.8898       Dynamic          1  FastEthernet0/1
0030.4871.b911       Dynamic          1  FastEthernet0/23
0050.455b.b27e       Dynamic          1  FastEthernet0/14
0050.50be.f9c8       Dynamic          3  FastEthernet0/22
0060.089a.8f70       Dynamic          1  FastEthernet0/24
0090.27f9.0abf       Dynamic          1  FastEthernet0/2
0090.27f9.1b53       Dynamic          1  FastEthernet0/24
00b0.d020.b557       Dynamic          1  FastEthernet0/9
00b0.d020.df60       Dynamic          1  FastEthernet0/1
00b0.d020.fc4a       Dynamic          1  FastEthernet0/1
00b0.d049.125b       Dynamic          1  FastEthernet0/1
00b0.d049.16a4       Dynamic          1  FastEthernet0/1
00b0.d049.98e4       Dynamic          1  FastEthernet0/24
00b0.d049.a43e       Dynamic          1  FastEthernet0/24
00b0.d049.d03c       Dynamic          1  FastEthernet0/1
00b0.d049.d61f       Dynamic          1  FastEthernet0/1
00b0.d049.e643       Dynamic          1  FastEthernet0/1
00b0.d068.1911       Dynamic          1  FastEthernet0/10
00b0.d068.490b       Dynamic          1  FastEthernet0/24
001e.c95a.d225       Dynamic          1  FastEthernet0/12
00b0.d068.7599       Dynamic          1  FastEthernet0/24
00b0.d068.8451       Dynamic          1  FastEthernet0/6
00b0.d0b0.306b       Dynamic          1  FastEthernet0/1
00b0.d0b0.4020       Dynamic          1  FastEthernet0/11
00b0.d0b0.70bd       Dynamic          1  FastEthernet0/1
00b0.d0b0.c5a4       Dynamic          1  FastEthernet0/1
00b0.d0b0.f533       Dynamic          1  FastEthernet0/24
0800.20c2.1de3       Dynamic          3  FastEthernet0/22

Let's say you want to know what IP's are on port 12. We see the mac address is 001e.c95a.d225 If we look that up in the router we can find the arp'd IP on that mac address:

Castle (3750):

E-mon-3750>en
E-mon-3750#show arp | include 001e.c95a.d225
Internet  69.55.228.149          39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.228.137          39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.238.164          39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.228.172          38   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.228.212          40   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.238.212          39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.228.196          25   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.24           38   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.25           40   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.27           39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.30           34   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.31           26   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.16           40   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.19           39   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.236.18           38   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.236.14           23   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.14           40   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.15           42   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.3            53   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.5            40   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.6            26   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.234.57           38   001e.c95a.d225  ARPA   Vlan50
Internet  69.55.230.53           38   001e.c95a.d225  ARPA   Vlan50

And we can look at some of these IPs and we quickly realize that they all belong to jail2 and if we look at jail2 we also see the correlation with the mac (ether 00:1e:c9:5a:d2:25):

jail2 /root# ifconfig
bce0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4>
        ether 00:1e:c9:5a:d2:27
        inet 10.1.4.102 netmask 0xffffff00 broadcast 10.1.4.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
bce1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4>
        ether 00:1e:c9:5a:d2:25
        inet 69.55.228.53 netmask 0xffffff00 broadcast 69.55.228.255
        inet 69.55.227.56 netmask 0xffffff00 broadcast 69.55.227.255
        inet 69.55.227.57 netmask 0xffffffff broadcast 69.55.227.57
        inet 69.55.227.58 netmask 0xffffffff broadcast 69.55.227.58
        inet 69.55.227.59 netmask 0xffffffff broadcast 69.55.227.59
        inet 69.55.227.60 netmask 0xffffffff broadcast 69.55.227.60
-SNIP-

If we are doing the lookup at i2b:

firewall2 /usr/home/user# arp -a | grep 00:0c:29:be:0f:e3
? (69.55.229.150) at 00:0c:29:be:0f:e3 on bge1 [ethernet]
firewall2 /usr/home/user#

Note how we have to format the mac address differently than we do on a cisco switch.


The same search works in reverse. Let's say you have an IP and you want to know which port it's on. First lookup the IP:

Castle:

E-mon-3750#show arp | include 69.55.227.4
Internet  69.55.227.4            78   0030.4828.9d50  ARPA   Vlan50
Internet  69.55.227.49            0   Incomplete      ARPA
Internet  69.55.227.48            0   Incomplete      ARPA
Internet  69.55.227.41            0   Incomplete      ARPA
Internet  69.55.227.40            0   Incomplete      ARPA
Internet  69.55.227.43            0   Incomplete      ARPA
Internet  69.55.227.42            0   Incomplete      ARPA
Internet  69.55.227.45            0   Incomplete      ARPA
Internet  69.55.227.44            0   Incomplete      ARPA
Internet  69.55.227.47          179   001e.c95a.d54f  ARPA   Vlan50
Internet  69.55.227.46            0   Incomplete      ARPA
E-mon-3750#

i2b:

firewall2 /usr/home/user# arp -a | grep 69.55.229.156
? (69.55.229.156) at 00:15:17:da:2e:fb on bge1 [ethernet]

So we take that mac (e.x. 0030.4828.9d50) and on each of our switches we run:

switch-p1> en
switch-p1#show mac-address-table | include 0030.4828.9d50

until we find the port. Note, some ios's may not let you run the include command, if so just run show mac-address-table without the include

Controlling port speed

Quick commands, speed 10Mbps:

enable
configure terminal
interface fastEthernet 0/17
speed 10
exit
exit

Set to 100Mbps:

enable
configure terminal
interface fastEthernet 0/17
speed 100
exit
exit

Sample output: switch-p1>enable switch-p1#show interfaces fastEthernet 0/12 switch-p1#sh int FastEthernet0/12 FastEthernet0/12 is down, line protocol is down

 Hardware is Fast Ethernet, address is 0002.b9b1.4c0c (bia 0002.b9b1.4c0c)
 MTU 1500 bytes, BW 0 Kbit, DLY 0 usec,
    reliability 255/255, txload 1/255, rxload 1/255
 Encapsulation ARPA, loopback not set
 Keepalive not set
 Auto-duplex , 100Mb/s, 100BaseTX/FX
 ARP type: ARPA, ARP Timeout 04:00:00
 Last input never, output 5w6d, output hang never
 Last clearing of "show interface" counters never
 Queueing strategy: fifo
 Output queue 0/40, 0 drops; input queue 0/75, 0 drops
 5 minute input rate 0 bits/sec, 0 packets/sec
 5 minute output rate 0 bits/sec, 0 packets/sec
    1126 packets input, 1574484 bytes
    Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
    0 watchdog, 0 multicast
    0 input packets with dribble condition detected
    779 packets output, 54919 bytes, 0 underruns
    0 output errors, 0 collisions, 2 interface resets
    0 babbles, 0 late collision, 0 deferred
    0 lost carrier, 0 no carrier

switch-p1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. switch-p1(config)#interface fastEthernet 0/12 switch-p1(config-if)#speed 10 switch-p1(config-if)#exit switch-p1(config)#exit switch-p1#sh int FastEthernet0/12 FastEthernet0/12 is down, line protocol is down

 Hardware is Fast Ethernet, address is 0002.b9b1.4c0c (bia 0002.b9b1.4c0c)
 MTU 1500 bytes, BW 0 Kbit, DLY 0 usec,
    reliability 255/255, txload 1/255, rxload 1/255
 Encapsulation ARPA, loopback not set
 Keepalive not set
 Auto-duplex , 10Mb/s, 100BaseTX/FX
 ARP type: ARPA, ARP Timeout 04:00:00
 Last input never, output 5w6d, output hang never
 Last clearing of "show interface" counters never
 Queueing strategy: fifo
 Output queue 0/40, 0 drops; input queue 0/75, 0 drops
 5 minute input rate 0 bits/sec, 0 packets/sec
 5 minute output rate 0 bits/sec, 0 packets/sec
    1126 packets input, 1574484 bytes
    Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
    0 watchdog, 0 multicast
    0 input packets with dribble condition detected
    779 packets output, 54919 bytes, 0 underruns
    0 output errors, 0 collisions, 2 interface resets
    0 babbles, 0 late collision, 0 deferred
    0 lost carrier, 0 no carrier

switch-p1#

Shutting down a port

Quick commands:

enable
configure terminal
interface fastEthernet 0/17
shutdown
exit
exit

Turn back on:

enable
configure terminal
interface fastEthernet 0/17
no shutdown
exit
exit

Sample output:

switch-p1>enable
switch-p1#show interfaces fastEthernet 0/17
FastEthernet0/17 is down, line protocol is down
  Hardware is Fast Ethernet, address is 0050.d1d8.94d1 (bia 0050.d1d8.94d1)
  MTU 1500 bytes, BW 0 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set, keepalive not set
  Duplex setting unknown, Unknown Speed, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     1 packets input, 64 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast
     0 input packets with dribble condition detected
     1 packets output, 64 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
switch-p1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
switch-p1(config)#interface fastEthernet 0/17
switch-p1(config-if)#shutdown
%LINK-5-CHANGED: Interface FastEthernet0/17, changed state to administratively down
switch-p1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface FastEthernet0/17, changed state to up
%LINK-3-UPDOWN: Interface FastEthernet0/17, changed state to down
switch-p1(config-if)#exit
switch-p1(config)#exit
switch-p1#

Show port stats

For one port:

switch-p1> en
switch-p1#show int FastEthernet0/7
FastEthernet0/7 is up, line protocol is up
  Hardware is Fast Ethernet, address is 0050.d1d8.94c7 (bia 0050.d1d8.94c7)
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set, keepalive not set
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output 00:00:02, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 9000 bits/sec, 20 packets/sec
     137101258 packets input, 2869037621 bytes, 0 no buffer
     Received 326 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 26 ignored, 0 abort
     0 watchdog, 0 multicast
     0 input packets with dribble condition detected
     330219386 packets output, 3304714878 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out

For all ports:

switch-p1> en
switch-p1#show interfaces
VLAN1 is up, line protocol is down
  Hardware is CPU Interface, address is 0050.d1d8.94c0 (bia 0050.d1d8.94c0)
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set, keepalive not set
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:10, output 00:00:10, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     137465 packets input, 10297233 bytes, 0 no buffer
     Received 89751 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 302 ignored, 0 abort
     0 input packets with dribble condition detected
     52396 packets output, 6878747 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
VLAN3 is up, line protocol is up
  Hardware is CPU Interface, address is 0050.d1d8.94c0 (bia 0050.d1d8.94c0)
  Internet address is 10.1.4.5/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  Encapsulation ARPA
  ARP type: ARPA, ARP Timeout 04:00:00
FastEthernet0/1 is up, line protocol is up
  Hardware is Fast Ethernet, address is 0050.d1d8.94c1 (bia 0050.d1d8.94c1)
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 3/255
  Encapsulation ARPA, loopback not set, keepalive not set
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:37, output 00:00:53, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 4593000 bits/sec, 762 packets/sec
  5 minute output rate 1240000 bits/sec, 689 packets/sec
     260548696 packets input, 2531757155 bytes, 0 no buffer
     Received 22173 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 333 ignored, 0 abort
     0 watchdog, 2942 multicast
     0 input packets with dribble condition detected
     241281983 packets output, 3622221090 bytes, 0 underruns
     0 output errors, 0 collisions, 15 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
FastEthernet0/2 is up, line protocol is up
  Hardware is Fast Ethernet, address is 0050.d1d8.94c2 (bia 0050.d1d8.94c2)
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set, keepalive not set
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output 00:00:54, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 146000 bits/sec, 108 packets/sec
  5 minute output rate 98000 bits/sec, 114 packets/sec
     22830604 packets input, 905395220 bytes, 0 no buffer
     Received 9845 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 10 ignored, 0 abort
     0 watchdog, 3 multicast
     0 input packets with dribble condition detected
     23910838 packets output, 3702256298 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
 --More--