Archive for August, 2008
Setting Up Syslog on a Linux Box for Your IOS Devices
Aug 26th
A few articles ago, we discussed getting logging up and running on your IOS box. Part of the discussion was actually having the device log remotely to a box somewhere, but that’s kind of worthless without a properly (for definitions of proper) configured syslog server. A low-end Linux box with an appropriate amount of disk space is a really good candidate to do this for you. I’ll assume you’re running some Redhat-based distro.
I won’t go through the installation, but it should be easy. Just look for the syslog packages for your distro and you should wind up with a working copy on your box. On a Redhat distro, you’ll probably just do a yum install syslog to get it working.
The first thing you need to do is to configure the daemon to listen for remote machines, so open in /etc/sysconfig/syslog in your favorite editor (read: vi) and change the SYSLOGD_OPTIONS line to read this.
SYSLOGD_OPTIONS=”-m 0 -r”
By default, if you restarted the daemon now, you’d wind up sending all your syslog messages to /var/log/boot.log. That may be alright for you, but, if you have a lot of devices, you may want to log them to another file. To do that, you need to change the local7 line at the bottom of /etc/syslog.conf. Just add this and comment out the original line.
# Write router messages to /var/log/cisco.log
local7.* /var/log/cisco.log
<NOTE>
This is not the best way to do handles messages from IOS devices, but it’ll get your started. You’ll want to look at changing the facility or further filtering the logging based on facility and severity. In several setups I’ve done, the devices all log to files based on function — routers to one file, firewalls to another, switches to another, etc. — and those files are rotated every X hours.
</NOTE>
That’s all the configuration you need, so let’s restart the service for everything to spring into action.
/etc/init.d/syslogd restart
In a perfect world, when your IOS devices are configured properly, you’ll have a nice log of IOS messages to keep for posterity.
Running Multiple Data Centers on a Stick with the CSM
Aug 12th
That’s an awesome title, eh? I’ve mentioned a router-on-a-stick before but not a data-center-on-a-stick (DCOAS). This is one of those Cisco terms I ran across a while ago and is a group of servers sort of sticking out on their own behind a load balancer and/or firewall. Connections to and from the server group go through a single spoke — kinda like stubby routing. Here’s a pretty picture.

To configure this type of setup on the CSM, assuming you’re running in router mode, you just define a server and client VLAN pair along with an alias IP on the server VLAN. The servers on that VLAN point to the alias as their gateway for return traffic, and the CSM handles the VIP/RIP conversion.
What if you have more than one server/client VLAN pair, though?

You set up your VLANs and your server VLAN alias for both sets and all is well, right? Not really. The CSM isn’t a router and doesn’t do a very good job at routing. If you were to send traffic from “Other Stuff” to a VIP on VLAN101, everything works great. If, however, one of those servers initiates a connection, the traffic will come out of the client VLAN with the lowest VLAN ID. If you have VLANs 1 and 2 for the top pair, traffic from all servers will come out VLAN 1. Very big problem if you have a firewall that’s expecting traffic on another interface.
How do you get around it, then? You have to trick the CSM by generating new catch-all vservers on each server VLAN to “load balance” the gateway for each VLAN. Let’s look at the configs.
Here are the serverfarms.
serverfarm VLAN1-SF
no nat server
no nat client
real 1.1.1.1
inserviceserverfarm VLAN101-SF
no nat server
no nat client
real 1.1.101.1
inservice
And the vservers.
vserver VLAN1-VS
virtual 0.0.0.0 0.0.0.0 any
vlan 2
serverfarm VLAN1-SF
inservicevserver VLAN101-VS
virtual 0.0.0.0 0.0.0.0 any
vlan 102
serverfarm VLAN101-SF
inservice
When a server makes a new connection to a database or whatnot, it sends the traffic to the alias you already configured on the server VLAN. When the CSM receives that traffic through the alias, this new vserver takes over since it’s set for any protocol and port on any IP. This vserver uses a serverfarm that contains the gateway for the appropriate client VLAN — in our case, the IP of the firewall — so now every connection from the server will exit an appropriate VLAN instead of out the lowest ID.
Confusing? Yes. Should be fixed? Yes. Is already fixed? I have no idea, but it’s not as of 12.2 and some change.
Setting Up System Logging on an IOS Device
Aug 11th
I like logging on an IOS device. I like to look at the buffer and tell you that your interface went down 30 seconds ago. I like to look on the box and see that BGP with my Internet provider has been flapping since 02:13ET. I like to look and see that one of the other guys has been making changes to the gear all morning. I could go on and on.
There are lots of ways to monitor a Cisco box — SNMP polling, SNMP traps, show commands, etc. — but there’s nothing so handy as the log buffer. A show logging can provide you all sorts of information on things you do and don’t care about, so it’s important to know the destinations and levels when setting up logging.
There are four logging destinations.
- Console — logs to the console ports of the device
- Monitor — logs to any device or pseudo-device that’s in monitoring mode. The most common application is when you do a terminal monitor to see output of debugs.
- Buffer — logs to a memory device that let’s you see the log messages on demand. It has a finite size and scrolls old messages out after X bytes have been written.
- Host or Trap — logs to an external syslog server.
What’s the most important destination? There’s not one. I personally thing the syslog host is the most important since it allows you to log messages to disk on a server somewhere. The buffer is also important since it lets anyone with access see what’s going on with the device. Your mileage will vary depending on what you have set up.
There are eight logging levels as well.
- Debug – level 7
- Informational – level 6
- Notifications – level 5
- Warnings – level 4
- Errors – level 3
- Critical – level 2
- Alerts – level 1
- Emergencies – level 0
Wow. There’s some numbers. What does it mean? Every logging message comes with a level. If my CSM loses a RIP, it generates a level 6 message (%CSM_SLB-6-RSERVERSTATE) telling me. If I configure the box, I get a level 5 message (%SYS-5-CONFIG_I) saying that I’ve done so. If my router is on fire in the rack, I’ll get a level 0 message telling me. Now, when you configure a destination, you have to give a logging level, and every message at that level or below will be logged. If I set my logging buffer to 5, I’ll see the configuration message and the “Oh, the humanity!” message, but not the RIP failures. If I set it to 0, I only see the emergencies. If I set it to 7, I see everything.
Let’s do the configuration, then. After hours or research, you’ve decided to use a remote syslog server at 1.2.3.4 for warnings and the buffer for informational. Here’s what you’d do.
logging host 1.2.3.4
logging trap warnings
logging buffer information
It’s not that hard. You can even use the number instead of the words for the logging level if you would like. The same procedure holds true for the console and monitor mechanisms — logging <mechanism> <level>. Easy.
If you care, here’s what I usually run.
- Console — off. I’ve seen a console rendered unusable because the console was being obliterated with syslog messages. Not only is it an issue with being able to see what you’re typing when stuff is scrolling, but some older devices wind up using 100% CPU because they’re sending messages to the console.
- Monitor — debug. It doesn’t really log anything unless you do a term mon or something, and, in that case, I want to see my debugs.
- Buffer — informational, but it depends on the device. It lets me see all the messages except for debugs, which is probably just right for most routers and switches. If you’re switch is in a closet somewhere with users plugged directly into it, you may be flooded with up/down messages, so keep an eye out for stuff like that.
- Host or Trap — informational. Debug’s a little too much for the corporate environment, but, depending on how much disk space you have, you may be able to handle it.
There’s a lot more to syslog and log messages, so see this nifty Cisco page.