Copy file to an FTP server with EEM applet
event manager applet backup-crl
event timer watchdog time 86400 maxrun 4294967295
action 1.0 cli command "enable"
action 2.0 cli command "copy flash:/iosca.crl ftp://username:[email protected]/" pattern "a.b.c.d"
action 3.0 cli command "a.b.c.d" pattern "iosca.crl"
action 4.0 cli command "iosca.crl"
action 5.0 syslog msg "FTP backup successful"
Use extended access-lists to filter BGP updates
When I've included a few slides on this feature in the first BGP course I've developed for Cisco (that was probably somewhere around 1994), the results in the class were always the same: total confusion that needed an hour of whiteboard examples to dissolve. You can find a few examples that will help you understand this arcane feature in a post written by Brian Dennis.
The use of extended IP ACL as a route matching mechanism was made obsolete by the ip prefix-list command, which was introduced in 12.0T. As 12.0T reached End-of-Engineering in the previous millennium, it's a safe bet that the only place where you might still be required to use extended ACLs to match IP routes is in the CCIE lab.
Router Fragmentation Is Gone from IPv6
In response to my Never-Ending Story of IP Fragmentation, Stojanco Cavdarov made an interesting observation: routers are not allowed to fragment IPv6 packets, they have to respond back with ICMP unreachable (effectively, routers behave as if IPv6 packets would have an implicit don't fragment bit).
To make life easier for non-TCP IPv6 applications (TCP is supposed to use Path MTU Discovery), the minimum IPv6 packet size that has to be supported on all links was increased to 1280 bytes (which, incidentally, fits very nicely into GRE+IPSec envelope transported across links with 1500-byte MTU).
WAN IP addresses and subnet masks
“What I would like to know is, on my PPP negotiated ADSL connection, how the ISP assigns me a /32 ip address.”… which prompted me to test various WAN encapsulations and address assignment rules. Here are the results:
- On all WAN encapsulations you can configure subnet masks down to /31 (/30 in old IOS releases).
- The same IP address can be used on more than one interface as long as both IP address and subnet mask match.
- Two WAN interfaces can have different IP addresses but still belong to the same IP subnet. You would use this on Frame Relay when you have multiple interfaces into the same FR cloud for bandwidth reasons.
- If you configure IP address with IPCP (with the ip address negotiated command), the subnet mask becomes /32 as IPCP does not carry subnet mask (and you get the host route toward the PPP peer unless you turn off the PPP peer route option)
- If you configure IP address with SLARP (Serial Line ARP) on HDLC, the subnet mask is inherited from the peer (HDLC SLARP carries subnet mask) and the IP address is determined by flipping the low-order bits in the neighbor's IP address.
Phase 2: Upload text files through a Telnet session
The trick works flawlessly, but typing the same obscure Tcl commands gets tedious after a while, so the first time I had to use this solution to develop a Tcl script, I've quickly written another script that takes file name as the parameter and hides all the other murky details.
To use it, transfer the contents of storeFile.tcl (available from my web site) to the router's flash (using the previously described trick), follow the installation instructions in the source and you're ready to go.
Note: You can adapt the Tcl script to your needs; for example, you could add instructions to re-register EEM Tcl policy every time you upload the new code.
Debugging time-based configuration
alias exec 859 clock set 08:59:30
alias exec 900 clock set 09:00:30
Obviously, these tests are best done in a lab setup … and you have to turn off NTP or any other form of time synchronization.
Building Customer-Resilient BGP networks
When Kate Gerwig, my wonderful editor from SearchTelecom.com, and myself agreed on the contents of the “Building customer-resilient BGP networks” article, we had no idea that it would become extremely relevant just days before it was published. The article describes the tools a Service Provider should use to ensure that its customers cannot harm its BGP routing data (and consequently its other customers and the Internet at large).
On February 24th, someone in Pakistan decided to block local access to YouTube … and someone else decided that the best way to approach the problem was to block the whole world’s access to YouTube.
Unconditional trunking port on a Catalyst 3560
Rob van Ooijen has sent me a really interesting question:
I've configured a switch port to be unconditionally a trunk with the switchport mode trunk configuration command. However, when the interface was enabled, I've got a dynamic trap indicating the trunking was still dynamic (and the show commands also showed negotiation of trunking is enabled).
In fact, adjacent layer-2 devices can negotiate a number of things these days, among them:
- Speed and duplex settings (we'll leave this can of worms safely closed);
- Trunking (a port can be access or trunk port);
- Trunk encapsulation (ISL or 802.1q);
With the switchport mode trunk command you just disable the trunking negotiation (the port will never become an access port), but the switch still runs Dynamic Trunking Protocol (DTP) on it, unless you disable DTP with switchport nonegotiate, which (in combination with all the other configuration commands) makes the port configuration totally static. More configuration can be found in Cisco's documentation and in the Basics of DTP document.
This article is part of You've asked for it series.
Merging VTY configurations
line vty 0 2He wanted to merge the three configuration blocks back into a single one but somehow didn't know how to do it.
login
line vty 3
password secret
login
line vty 4
login
To realize what's going on, you have to understand how the IOS generates line configurations. It takes the first line (VTY 0, for example) and generates its configuration. If the next line (VTY 1) has exactly the same configuration, the range of numbers is expanded (becoming VTY 0 1) and so forth until the pool of similar lines is exhausted or a line is found that has at least one parameter different from the starting one, in which case a new block is started. That's why the sample configuration has three blocks (0-2, 3 and 4) even though the first and the third block are identical.
However, if you change the offending parameter, the VTY lines will have identical configurations and will be automatically merged. If you want to be on the safe side, you should change the parameter for all lines, for example:
line vty 0 4
login
password secret
Note: This article is part of You've asked for it series.
Reduce IP addressing errors in lab environment
hostname Core-2… and use IPCP negotiation on the POP router to pick up the WAN IP address:
!
interface Serial1/0
description link to POP
ip address 10.0.2.1 255.255.255.252
encapsulation ppp
peer default ip address 10.0.2.2
hostname POP
!
interface Serial1/0
description link to Core-1
ip address negotiated
encapsulation ppp
You should not configure no peer neighbor-route on the router that gets dynamic IP address, as the subnet mask is not assigned with IPCP; you need the IPCP-generated host routes if you want to do hop-by-hop telnet between the routers.
Time-based BGP policy routing
He uses BGP communities to achieve the switch (perfect solution if your ISP supports them) and time-based ACL in a route-map to set the community based on time-of-day. As Cisco changed the way BGP imports local routes in IOS release 12.3T, he then devises an ingenious solution based on reliable static routing to trigger a change in the IP routing table.
The optimum solution is way simpler: you just configure two EEM applets to perform clear ip route network command at appropriate times.
Environment variables set by EEM applet action commands
“Cisco IOS Hints” blog featured in NetworkWorld

It's well worth browsing through the list. I already had most of these sites in my feed reader and I've discovered a few new nuggets.
Use all the tools you have
For example, an Internet Service Provider might want to filter incoming updates received from the customers to ensure they’re not advertising transit routes and advertise only IP prefixes they actually own. Inbound route maps might also be needed to attach BGP communities to inbound routes or set BGP attributes (for example, local preference) based on communities attached to incoming routing updates.
You can perform all these tasks with route-maps, but then you’d probably have to create a dedicated route-map for each customer (as the inbound prefix filter has to be customer-specific). Changing your routing policies or community definitions would require changing a lot of route maps.
Update 21-feb-08@15:39: distribute lists and prefix lists can't coexist (they cannot be configured in the same direction on the same neighbor)
On the other hand, if you use all the filters available in the BGP routing process, you could:- Use neighbor filter-list in to check the customer-specific AS path requirements;
- Use neighbor prefix-list in to filter customer prefixes, reject too long prefixes or prefixes not belonging to the customer;
- Use neighbor route-map in to drop prefixes belonging to your own address space, implement various routing policies and set BGP communities.
The solution scales even better if you configure common filters (route-map in and filter-list in in our scenario) in a BGP peer session template.
Differentiating between port scanners and legitimate users
“Is there a way to have a port on a router open for legitimate use while closed to port scanning software and the such. For example. I have SSL VPN configured on my IOS router. Is it possible to have the port seem stealthed to port scanners while still allowing legitimate access to the service? An example being, allowing a web browser to connect using the port but making sure that a port scanner doesn't detect it as open.”The short answer is no, unless you can differentiate legitimate users by their IP addresses. The port scanners (when using SYN scan) simply open and close a TCP session, and there is no way for a router to differentiate between the legitimate users (who would send valid HTTP GET requests) and port scanners (that would close the session as soon as it's established).
If you can distinguish between legitimate users and everyone else based on their IP address, the task becomes simpler: either you apply inbound access list on Internet-facing interface of the router or configure per-service access-list (for example, ip http access-class acl). When using the inbound access-list, the port appears filtered or stealth, when configuring per-service access-class, it's reported as closed.