Thursday, June 21, 2012

Learn NAT in 5 minutes

To have a public IP-Address costs money. To have a whole public subnet, costs more money.
So companys with little money but clever admins can use a technic, which helps them to use less
public IP-Addresses, but make it possible for lots of clients to connect to the Internet.

This technic is called NAT or Network Address Translation.
As the name says, an Network Address (IP-Address) is been translated to another address.
Mostly, a private IP-Address (172.16.X.X or 196.168.X.X) is translated in a public IP which the company
gets from an ISP and pays for the public IP or IPs.

There are some terms which must be understanded before going deeper in that material.
Its necessary for CCNA Certification to differ between them.

Inside local address
A private IP Address, not useable in the Internet.

Inside global address
A public IP address in the inside network.

Outside local address
A IP on the outside of the network, as its seen by an inside host.
Not necessarily public address.

Outside global address
A IP address in the outside network, which is a public address.


There are three forms of NAT

Static NAT
ONE private IP is translated to ONE public IP.
Allways the same private IP is mapped to the same public IP.

Dynamic NAT
A private IP is mapped to a public IP, which is from a pool of public IPs.
It must not allways be the same privat IP, which is mapped to a specific public IP.
This is selected dynamically. 

Overloading
Many private IPs are mapped to one public IP.
This is also known as PAT (Port Address Translation).
Its a Form of dynamic NAT.
A private IP establishes a connection, for example is source port 2353.
The pakets come to the router. The router translates the IP to a public IP.
The router writes the Information about source IP and source Port into
its NAT Table. When the answer Pakets arrive from Internet the router again
checks its NAT Table and translates the pakets back to the private IP from where
the requesting pakets did origin, depending on the port entry in NAT Table.


Configuration commands

Static NAT

router(config)#ip nat inside source static local-ip global-ip
router(config)#interface fa0/4
router(config-if)#ip nat inside <<<interface inside network
router(config)#interface fa0/4
router(config-if)#exit
router(config)#interface s0
router(config-if)#ip nat outside >>>interface outside network

Dynamic NAT

router(config)#ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length}
router(config)#access-list acl-number permit source-IP [source-wildcard]
router(config)#ip nat inside source list acl-number pool name
router(config)#interface fa0/4
router(config-if)#ip nat inside 
router(config-if)#exit
router(config)#interface s0
router(config-if)#ip nat outside 

Overloading

router(config)#access-list acl-number permit source-IP source-wildcard
router(config)#ip nat inside source list acl-number interface interface overload
router(config)#interface fa0/4
router(config-if)#ip nat inside
router(config-if)#exit
router(config)#interface s0
router(config-if)#ip nat outside

Configure Time & Date

In this short post I will configure my router with the correct timezone, time and date.


router1#sh clock detail 
*01:56:43.478 UTC Mon Oct 19 2009
No time source


router1#conf t 
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#clock timezone GMT 0
router1(config)#end


router1#sh clock detail 
*01:59:54.390 GMT Mon Oct 19 2009
No time source


router1#clock set 14:10:00 20 MARCH 2010 


router1#sh clock detail 
14:10:16.183 GMT Sat Mar 20 2010
Time source is user configuration

VLANS

- Flat network -- when a broadcast reaches all segments of a network (in a Layer-2 switched network). If a router is present, a broadcast is confined to the originating segment.
- VLANs -- logically grouped switch ports. Without a router, there can be no communication between VLANs.
- VLAN basic features:
- A VLAN can group several broadcast domains into multiple logical subnets.
- Network adds, moves, and changes are achieved by configuring a port into the appropriate VLAN.
- A group of users needing high security can be put into a separate VLAN.
- VLANs can be considered independent from their physical or geographic location.
- Broadcast Control -- broadcast-intensive applications can be placed in a separate VLAN, so they don't put a load on the rest of the network.
- Security -- Administrators have full control over every switch port. In addition, switches can be configured to notify a management station of any unauthorized access.
- Flexibility and Scalability -- Users can be added to a specific VLAN, regardless of their physical location. Also, a VLAN can be split into more VLANs, if necessary.
- VLAN 1 is an administrative VLAN. Cisco recommends you use it for administrative purposes only. So, usable VLANs start from 2.
- Static VLANs -- Each switch port is statically assigned to a particular VLAN, and this relationship never changes. This is how usually VLANs are set up. Monitoring is easy.
- Dynamic VLANs -- All MAC addresses are initially entered into a centralized VLAN management application. Then, when a host is plugged into a switch, VLAN association happens automatically.
- VLAN Management Policy Server (VMPS) -- contains the VMPS database maps, containing MAC addresses and their association with VLANs.
- Types of VLAN links:
- Access links -- Each switch port has a single native VLAN (access link). Whatever machine is connected to this port is unaware of the network design. It can ONLY communicate with machines on the same VLAN.
- Trunk links -- 100Mbps (FastE) or 1000Mbps (GigE). They can carry multiple VLANs (1 to 1005). Switches are "trunked" together via the trunk links. A server can be attached to a trunk link in order to be a direct member of 2 or more VLANs.
- Switch fabric -- a group of switches sharing the same VLAN information.
- Frame tagging -- each frame is assigned a tag, called a "VLAN ID" or a "color". When the frame reaches the destination port, the switch removes this ID, thus making the process transparent to the connected machines.
- VLAN Identification Methods:
- Inter-Switch Link (ISL) -- proprietary to Cisco switches, used for FastE or GigE links only. ISL routing can be used on a switch port, router interfaces, or server interface cards.
- IEEE 802.1q -- a standard method that inserts a field into the frame to identify the VLAN. IEEE 802.1q must be used if you are trunking between a Cisco switch an a different brand of switch.
- LAN emulation (LANE) -- used to communicate multiple VLANs over ATM.
- 802.10 (FDDI) -- proprietary to Cisco devices -- used for sending VLAN information over FDDI.
- 80/20 rule -- 80 percent of the data traffic should stay on the local segment, while 20 percent or less can cross a segmentation device.
- A trunked server can be on multiple VLANs simultaneously, so there is no need for a router to access this server.
- Inter-Switch Link (ISL) Protocol -- provides low-latency, full wire-speed performance, in contrast to FastE, which uses either half- or full-duplex mode:
- When using ISL, the original frame is encapsulated with a new 26-byte ISL header, plus a 4-byte frame check sequence (FCS) field. Only ISL-aware devices can read the frame, which can be as large as 1522 bytes (larger than the max 1518 byte frame on an Ethernet segment).
- ISL NICs are used in trunked servers. This eliminates the need for a router.
- ISL VLAN information is added to a frame only if the frame is forwarded out a port configured as a trunk link. This information is removed when the frame reaches an access link.
- VLAN Trunk Protocol (VTP) -- allows centralized VLAN management. An administrator can add, delete, and rename VLANs. VTP is NOT Cisco proprietary. Features:
- Consistent VLAN configuration across all switches in the network.
- VLANs can be trunked over mixed networks, like Ethernet to ATM LANE or FDDI.
- Accurate tracking and monitoring of VLANs.
- Dynamic reporting of added VLANs to all switches.
- Plug-and-Play VLAN adding.
- A VTP server uses a VTP domain. A switch can only be in one VTP domain. A VTP domain can be used if you have more than one switch. However, if all your switches are using a single VLAN, there is no need for VTP.
- VTP transparent mode -- switches forward VTP information through trunk ports, but do NOT accept information updates, or update their VTP databases.
- Passwords can be set up with VTP to prevent unauthorized adding of switches to a VTP domain, but this can be time-consuming.
- Switches detect VLAN information within a VTP advertisement, and then listen on their trunk ports for additional updates.
- VTP updates include a VLAN ID, 802.10 SAID fields, or LANE information.
- VTP updates are sent out as revision numbers that are the notification plus 1. Anytime a switch sees a higher revision number, it knows the received information is more current, and the switch will overwrite its current database.
- VTP Modes of Operation:
- Server -- default for all Catalyst switches -- the switch can update VTP information and push it to the whole VTP domain. At least one server is needed per VTP domain.
- Client -- receives information from a VTP server. None of the ports on a client switch can be added to a VLAN without information from the VTP server, which notifies the switch of the new VLAN.
! Hint -- if you want a switch to become a server, make it a client first. After it receives all VLAN information, change it to a server.
- Transparent -- switches in transparent mode do not participate in the VTP domain, but they still forward VTP advertisements. They can add and delete VLANs, but those VLANs are unique per switch, they don't propagate in the VTP domain.
- Server and Transparent configuration is saved in NVRAM, while client configuration is not saved in NVRAM.
- VTP Pruning -- only send broadcast, multicast, unicast information to trunk links that absolutely need this information. VTP Pruning preserves bandwidth:
- If switch A does not have any ports configured for VLAN 5, and a broadcast is sent throughout VLAN 5, that broadcast will not pass the trunk port of switch A.
- By enabling pruning on a VTP server, you enable it for the entire domain. By default, VLANs 2-1005 are pruning-eligible. VLAN 1 cannot prune, as it is the administrative VLAN.
- Routing between VLANs -- there are several possibilities:
- A router that has an interface for each VLAN.
- A router that supports ISL routing and has at least a FastE interface -- the least expensive one is the 2600 series. 1600, 1700, and 2500 series do not support ISL routing.
- A Route Switch Module (RSM) for a 5000 series switch. The RSM can support up to 1005 VLANs and runs on the backplane of the switch.
- "Router-on-a-stick" -- Router connecting all Vlans together allowing for inter-vlan communication, using only one router interface.
-all ports on a switch are members of vlan 1, by default' 

Null0 Interface for Loop Prevention


The Null0 interface is used to drop packets. In your example all packets not matching a more specific route in your routing table will be sent to Null0, which in fact means they will be dropped. You often see automatically generated static routes to Null0 as part of summarization in order to avoid routing loops.

The Null interface is typically used for preventing routing loops. Enhanced Interior Gateway Routing Protocol (EIGRP), for instance, always creates a route to the Null0 interface when it summarizes a group of routes. Whenever a routing protocol summarizes, this means that the router might receive traffic for any IP address within that summary. Because not all IP addresses are always in use, there is a risk of looping packets in case default routes are used on the router which receives the traffic for the summary.



A common scenario where you may need to add a static route to Null0 is that of an access server which has many clients dialing in. This scenario causes host routes to be installed in the access server routing table. To ensure reachability to these clients, while not flooding the entire network with host routes, other routers in the network typically have a summary route which points to the access server. In this type of configuration, the access server should have that same summary route pointing to the access server Null0 interface. If not, routing loops may occur when outside hosts attempt to reach IP addresses not currently assigned to a dialed in client but are part of the summary route. This is because the access server would bounce the packets back over the access server default route into the core network, because the access server lacks a specific host route for the destination.
Consider this example:
/image/gif/paws/14956/route_to_null_interface_01.gif
A small ISP (ISP-R1) gives one of his customers a network block of 192.168.0.0/16. In this example, the customer divided 192.168.0.0/16 in /24 networks and only uses 192.168.1.0/24 and 192.168.2.0/24 at the moment. On router ISP-R1, the ISP configures a static route for 192.168.0.0/16 toward the customer router (cust-R2). The ISP then connects to a backbone ISP, represented by router BB-R3. Router BB-R3 sends a default route to ISP-R1 and receives the network 192.168.0.0/16 via BGP from ISP-R1.
Reachability is now guaranteed from the Internet (backbone ISP router BB-R3) to the customer router cust-R2 because cust-R2 has a default route configured to point to ISP-R1. However, if packets are destined to network blocks which are not in use out of the 192.168.0.0/16 range, then the cust-R2 router uses the default route to ISP-R1 to forward those packets. The packs then loop between ISP-R1 and cust-R2 until the TTL expires. This can have a huge impact on the router CPU and link utilization. An example of where this traffic to unused IP addresses might come from could be denial of service attacks, scanning of IP blocks to find vulnerable hosts, etc


Packet flow:
Note: We enabled some debug commands on the routers to better illustrate the packet flow, notably debug ip packet and debug ip icmp. Do not enable these commands in a production environment unless you fully understand the consequences.
BB-R3# ping ip 192.168.20.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:

*Oct  6 09:36:45.355: IP: tableid=0, s=10.3.3.3 (local), d=192.168.20.1 (Serial2/0), routed via FIB
*Oct  6 09:36:45.355: IP: s=10.3.3.3 (local), d=192.168.20.1 (Serial2/0), len 100, sending.
Success rate is 0 percent (0/1)
BB-R3#
*Oct  6 09:36:50.943: ICMP: time exceeded rcvd from 10.0.0.1
BB-R3 sends a single ICMP request to an IP address within the 192.168.0.0/16 block which is not in use on cust-R2. BB-R3 receives an ICMP time exceeded back from ISP-R1.
On ISP-R1:
18:50:22: IP: tableid=0, s=10.3.3.3 (Serial1/0), d=192.168.20.1 (Serial0/0), routed via RIB
18:50:22: IP: s=10.3.3.3 (Serial1/0), d=192.168.20.1 (Serial0/0), g=192.168.20.1, len 100, forward
18:50:22: IP: tableid=0, s=10.3.3.3 (Serial0/0), d=192.168.20.1 (Serial0/0), routed via RIB
18:50:22: IP: s=10.3.3.3 (Serial0/0), d=192.168.20.1 (Serial0/0), g=192.168.20.1, len 100, forward
18:50:22: IP: tableid=0, s=10.3.3.3 (Serial0/0), d=192.168.20.1 (Serial0/0), routed via RIB
18:50:22: IP: s=10.3.3.3 (Serial0/0), d=192.168.20.1 (Serial0/0), g=192.168.20.1, len 100, forward
18:50:22: IP: tableid=0, s=10.3.3.3 (Serial0/0), d=192.168.20.1 (Serial0/0), routed via RIB
The initial packet is received on serial1/0 from BB-R3 and is forwarded to cust-R2 from serial0/0 as expected. The same packet arrives back at ISP-R1 on serial0/0 and is sent immediately out the same interface, to cust-R2, because of this route:
ISP-R1# show ip route 192.168.20.1
Routing entry for 192.168.0.0/16, supernet
  Known via "static", distance 1, metric 0 (connected)
  Advertised by bgp 65501
  Routing Descriptor Blocks:
  * directly connected, via Serial0/0
      Route metric is 0, traffic share count is 1
What happens on cust-R2 that causes it to send this traffic back to ISP-R1?
On cust-R2:
*Oct  6 09:41:43.495: IP: s=10.3.3.3 (Serial2/0), d=192.168.20.1 (Serial2/0), g=10.0.0.1, len 100, forward
*Oct  6 09:41:43.515: IP: tableid=0, s=10.3.3.3 (Serial2/0), d=192.168.20.1 (Serial2/0), routed via RIB
*Oct  6 09:41:43.515: IP: s=10.3.3.3 (Serial2/0), d=192.168.20.1 (Serial2/0), g=10.0.0.1, len 100, forward
*Oct  6 09:41:43.555: IP: tableid=0, s=10.3.3.3 (Serial2/0), d=192.168.20.1 (Serial2/0), routed via RIB
We see that cust-R2 sends these packets back to ISP-R1, because of this route:
cust-R2# show ip route 192.168.20.1 longer-prefixes 
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 10.0.0.1 to network 0.0.0.0

cust-R2#
Router cust-R2 does not have a route to 192.168.20.1 because this network is not in use in the customer network, so the best route to 192.168.20.1 is the default route which points to ISP-R1.
The result is that the packets loop between ISP-R1 and cust-R2 until the TTL expires.
Note that if the ICMP request had gone to an IP address within a network that is in use, this result would not occur. For example, if the ICMP request was for 192.168.1.x, which is directly connected on cust-R2, no looping would have occurred:
cust-R2# show ip rou 192.168.1.1
Routing entry for 192.168.1.0/24
  Known via "connected", distance 0, metric 0 (connected, via interface)
  Routing Descriptor Blocks:
  * directly connected, via Ethernet0/0
      Route metric is 0, traffic share count is 1
The solution to this problem is to configure a static route to Null0 for 192.168.0.0/16 on cust-R2.
cust-R2# conf t
Enter configuration commands, one per line.  End with CNTL/Z.
cust-R2(config)# ip route 192.168.0.0 255.255.0.0 Null0
cust-R2(config)# end
cust-R2#
*Oct  6 09:53:18.015: %SYS-5-CONFIG_I: Configured from console by console
cust-R2# show ip route 192.168.20.1
Routing entry for 192.168.0.0/16, supernet
  Known via "static", distance 1, metric 0 (connected)
  Routing Descriptor Blocks:
  * directly connected, via Null0
      Route metric is 0, traffic share count is 1
If we now resend the ICMP request from BB-R3 to 192.168.20.1, cust-R2 sends this traffic to Null0, which triggers an ICMP unreachable to be generated.
BB-R3# p ip 192.168.20.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
U
Success rate is 0 percent (0/1)
BB-R3#
*Oct  6 09:54:33.051: ICMP: dst (10.3.3.3) host unreachable rcv from 10.0.0.2
Note: There may be situations where the use of a summary static route to Null0 is not feasible. For example, if in the previous example:
  • Block 192.168.1.0/24 is connected to another router which dials into cust-R2 via ISDN
  • ISP-R1 does not allocate 192.168.0.0/16 but only 192.168.1.0/24
  • A disconnection of the ISDN link occurs
Note: The result would be that packets in transit or applications that attempt to reach this block of IP addresses create the same routing loop described earlier.
Note: To fix this routing loop, you must use the ip route 192.168.1.0 255.255.255.0 Null0 200 command to configure a floating static route to Null0 for 192.168.1.0/24. The 200 in the command is the administrative distance. Refer to What Is Administrative Distance? for more information.
Note: Because we use a higher administrative distance than any routing protocol, if the route to 192.168.1.0/24 via the ISDN link becomes inactive, cust-R2 installs a floating static route. Packets are then sent to Null0 until the ISDN link becomes active.

CDP Basic

CDP is the Cisco Discovery Protocol and is enabled on all router and switch interfaces by default. The switch or router sends a CDP packet out of each interface every 60 seconds, any connected device records the delivery of these packets into a CDP table for a holdtime period of 180 seconds. If after 180 seconds the device has not received any more CDP packets on that interface it removes the entry from the table. CDP can be disabled entirely or on any individual interface.


I begin by connecting to my switch and I check the CDP settings.

switch1#sh cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled


From the output I can see the CDP time settings and the version. Next I look at the connected devices.

switch1#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID
switch2.lab.localFas 0/1 160 S I WS-C2950-2Fas 0/1
switch2.lab.localFas 0/24 160 S I WS-C2950-2Fas 0/24


Here I can see that I have 2 ports (1 & 24) connected to switch2 (also using ports 1 & 24). I can also see that switch2 is a Catalyst 2950.

This is a great summary but for my diagram I could do with knowing the IP address of switch2.


switch1#sh cdp entry * 
-------------------------
Device ID: switch2.lab.local
Entry address(es):
IP address: 10.0.1.211
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/1
Holdtime : 142 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(13)EA1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2003 by cisco Systems, Inc.
Compiled Tue 04-Mar-03 02:14 by yenanh

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF01022505000000000000000CCE3E3EC0FF0000
VTP Management Domain: 'lab.local'
Native VLAN: 1
Duplex: full

-------------------------
Device ID: switch2.lab.local
Entry address(es):
IP address: 10.0.1.211
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/24, Port ID (outgoing port): FastEthernet0/24
Holdtime : 142 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(13)EA1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2003 by cisco Systems, Inc.
Compiled Tue 04-Mar-03 02:14 by yenanh

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF01022505000000000000000CCE3E3EC0FF0000
VTP Management Domain: 'lab.local'
Native VLAN: 1
Duplex: full


This detailed output gives me additional useful information such as the VLAN and the IOS version.

Next I head over to switch2 and look at it's CDP information.


switch2#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
switch1 Fas 0/24 168 S I WS-C2950-2Fas 0/24
switch1 Fas 0/1 168 S I WS-C2950-2Fas 0/1
router1.lab.localFas 0/2 175 R Cisco C831Eth 0
router1.lab.localFas 0/23 175 R Cisco C831Eth 1


Here I can see the connections to switch1 and additional connections to router1. Again I look at the detailed information to get the IP address of the router.


switch2#sh cdp entry *
-------------------------
Device ID: switch1
Entry address(es):
IP address: 10.0.1.210
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/24, Port ID (outgoing port): FastEthernet0/24
Holdtime : 152 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(12c)EA1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Sun 24-Nov-02 23:31 by antonino

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF01022505000000000000000C8582C600FF0000
VTP Management Domain: 'lab.local'
Native VLAN: 1
Duplex: full

-------------------------
Device ID: switch1
Entry address(es):
IP address: 10.0.1.210
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/1
Holdtime : 152 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(12c)EA1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Sun 24-Nov-02 23:31 by antonino

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF01022505000000000000000C8582C600FF0000
VTP Management Domain: 'lab.local'
Native VLAN: 1
Duplex: full

-------------------------
Device ID: router1.lab.local
Entry address(es):
IP address: 10.0.2.254
Platform: Cisco C831, Capabilities: Router
Interface: FastEthernet0/23, Port ID (outgoing port): Ethernet1
Holdtime : 176 sec

Version :
Cisco IOS Software, C831 Software (C831-K9O3Y6-M), Version 12.4(4)T1, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Thu 22-Dec-05 01:39 by ccai

advertisement version: 2
Duplex: half

-------------------------
Device ID: router1.lab.local
Entry address(es):
IP address: 10.0.1.254
Platform: Cisco C831, Capabilities: Router
Interface: FastEthernet0/2, Port ID (outgoing port): Ethernet0
Holdtime : 176 sec

Version :
Cisco IOS Software, C831 Software (C831-K9O3Y6-M), Version 12.4(4)T1, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Thu 22-Dec-05 01:39 by ccai

advertisement version: 2
Duplex: full


From the output I am able to determine the IP addresses of the connected router interfaces and I can also see that one interface is configured to half duplex. Now I have some good information to begin populating my diagram with.



From here I would probably move to the router and look at the CDP table. But supposing I want to prevent CDP packets from leaving an interface? After all, quite detailed information is included in CDP that you might not want everyone to view.

I connect to the device that I want to stop sending CDP packets and turn CDP off on that particular interface. In my case I would like to stop router1 from sending CDP packets on interface ethernet 1.

router1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#int ethernet 1
router1(config-if)#no cdp enable 
router1(config-if)#end

Now when I check the switch that router1 is connected to I see that the holdtime decreases as the switch receives no CDP packet on the interface until after 180 seconds it reaches 0 and the entry is removed from the table.


switch2#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
switch1 Fas 0/24 159 S I WS-C2950-2Fas 0/24
switch1 Fas 0/1 159 S I WS-C2950-2Fas 0/1
router1.lab.localFas 0/23 6 R Cisco C831Eth 1
router1.lab.localFas 0/2 126 R Cisco C831Eth 0

switch2#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
switch1 Fas 0/24 153 S I WS-C2950-2Fas 0/24
switch1 Fas 0/1 152 S I WS-C2950-2Fas 0/1
router1.lab.localFas 0/23 0 R Cisco C831Eth 1
router1.lab.localFas 0/2 179 R Cisco C831Eth 0

switch2#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
switch1 Fas 0/24 147 S I WS-C2950-2Fas 0/24
switch1 Fas 0/1 147 S I WS-C2950-2Fas 0/1
router1.lab.localFas 0/2 174 R Cisco C831Eth 0