Thursday, July 26, 2007

CISCO: Battle with Wake on LAN

The place I am currently employed, uses all CISCO equipment. This means getting in touch with your CLI side. I love the command line but IOS is a different breed of CLI. I can't say that I don't like...just sometimes it sucks.

Different IOSs do different things and different product lines only support certain IOS. Its really a vicious cycle of Cisco adding features to one and forcing customers to upgrade to get the better options.

As of late I was given the task of adding Wake on Lan to the environment to help out a team so that if their boxes went off line for some reason they could bring them back up remotely.

I began with some research into Wake on Lan technology and how it worked. Wake on lan basically involves the NIC of the machine being set up to listen while the computer is shut down but the NIC is still drawing power. The NIC is still listening on the network for the "magic" packet. This magic packet is a broadcast packet but what makes it special or magic is the data contained in it. The Mac address of the target machine is placed inside the data portion 12 to 14 times. Typically a udp packet it is a broadcast packet that is sent out usually over udp port 9.

At my place of employment we deploy higher end Cisco Catalyst 6500 series swithes. These guys have Layer 3 capabilities. As usually these are used as our distribution. We have several vlans that break up floors and other parts of the business. The team I was doing Wake on Lan for was coming from several different vlans and going to several vlans. Here is one of the problems with Wake on Lan intervlan (layer 3), broadcasts can't just go across vlans.

You have to help out the routing, just like in DHCP we use the ip helper address. The ip helper address tells the interface vlan what address to point to for broadcasts.

Here is the setup:

2 6500s for distributions connected together with 4Gb etherchannel then 2 2Gb channels to Access layer switches on various floors.

All vlans are on the distribution layer.

We have numerous vlans as said before here is an example of the vlans and the config needed for Wake on Lan.

interface Vlan20
description 1st Floor Vlan Wake on Lan Client
ip address 192.168.1.0 255.255.255.0
ip directed-broadcast 100

interface Vlan30
description 2nd Floor Vlan Wake on Lan Client
ip address 192.168.2.0 255.255.255.0
ip directed-broadcast 100

interface vlan40
description Wake on Lan Server
ip address 192.168.3.0 255.255.255.0
ip helper-address 192.168.1.255
ip helper-address 192.168.2.255

ip forward-protocol udp 9

access-list 100 permit udp host 192.168.3.2 any eq 9

The next commands should be placed on the access switches with the mac address of your various Wake on Lan clients. The reason just in case you run into the same problem I did with the mac address falling out of the table.

mac-address-table static 0014.09CA.1ad8 vlan 20 interface gi 1/0/1

After all the research and testing and now I can do Wake on Lan in my sleep. Anyway I just thought I would throw that out there on the Interwebs.

5 comments:

Unknown said...

I've was able to do this successfully on seperate vlans, howerver how would you do it accross a wan separted by 2 routers one on each side?

'Poody' Brown said...

bobnosnarb, if I am not mistaken the same principles apply, if you are layer 3 adjacent with the other router. You keep applying the ip directed-broadcast command on your interfaces, when you get to the vlan or Layer3 space your Wake on Lan Server is apply the ip address helper command.

This is interesting and I will set this up in my lab to see if I can get it to work. If you do get get it to work over the WAN please let me know.

Beekeeper said...

Are those network numbers that you have assigned as IP addresses on each of your vlans?

jg24dpchevy said...

I have roughly 700 clients locally and another 6000 remote users. Will it work without adding the static mac address? That would be virtually impossible for me to do.

BOOZy said...

There's a much easier way if you just need to incidentally WOL a device. It does require you to keep a tight administration regarding IP adresses, mac addresses and to which interfaces your devices are connected.

The trick is as follows:

1 - add a static arp entry for your device on the remote switch/router
2 - add a static mac entry for your device on the remote switch/router
3 - use a generic WOL tool to boot up your device by entering the IP and MAC address.
n.b in some occasions you might need to use the broadcast address (.255) instead of the actual IP address.