Showing posts with label Foundry. Show all posts
Showing posts with label Foundry. Show all posts

Wednesday, December 11, 2013

Configuring Port Security on a Foundry/Brocade FastIron Switch

I recently spoke with a user at a remote site on my network who was running into trouble getting on-line. During the troubleshooting session, I asked him to retrieve his IP address, and he gave me an address that was on a different subnet than I expected for his location. Puzzled, I asked a few follow-up questions, and found that he had connected a wireless router to my LAN switch at the remote site, a violation of our corporate compliance policies. In general, I'm not a fan of "Big Brother" IT/MIS policies, but in this case, I got a little torqued. This user is not MIS, he is not the guy who will get called out on the carpet if our network is breached because he didn't properly secure his wireless access point, and therefore, he is not supposed to be connecting wireless devices without explicit approval and knowledge of either me or one of the other network admins.

Unfortunately, this is not an uncommon occurrence. Fortunately, the Foundry FES2402 switches that we are using at these remote sites gives the network admin(s) some tools to help prevent users from connecting unauthorized devices to our networks.

The first tool is a simple MAC filter. In this case, there is a fixed number of devices that are supposed to be connected to our network, the MAC addresses of these devices are known, and therefore, we can create a filter to allow only these MAC addresses on a given port(s). Alternatively, if there is a known MAC address (or multiple addresses) that we *don't* want connected to a given port, we can create a filter to disallow it (or them). Here's how you do it:

  conf t
  mac filter 1 deny 0015.c507.ae6b ffff.ffff.ffff any
  mac filter 128 permit any any
    interface ethernet 7
      mac filter-group 1 128
      mac filter-group log-enable

This filter denies access from MAC address 0015.c507.ae6b to eth7, but allows access from all other MAC addresses.

Keep in mind that there are a few tips and a couple of "gotchas" in the simple MAC filter. First, just as when creating an Access Control List (ACL) or firewall rule for an IP address, you can filter for a portion of the MAC address, if you like:

  conf t
    mac filter 1 deny 0015.c507.ae6b ffff.0000.0000 any
    mac filter 128 permit any any
    interface ethernet 7
      mac filter-group 1 128
      mac filter-group log-enable

This will only match the "0015" portion of the given MAC address.

For a "gotcha," while there are many interface parameters that you can set using a range of Ethernet ports on a Foundry/Brocade switch, this isn’t one of them. For example, this…:

  conf t
  int eth 1 to 24
    mac filter-group 1 128
    mac filter-group log-enable

…doesn’t work. You can only apply a filter to a single interface at a time.

Another "gotcha" is that if you create multiple filters, then when applying the filters to an interface, you MUST include all of the filter groups on one line. If you try to put the filter groups on multiple lines, you will only get the LAST filter:

  conf t
  mac filter 1 deny 0015.c507.ae6b ffff.ffff.ffff any
  mac filter 128 permit any any
  int eth 7
      mac filter-group 1
      mac filter-group 128
      mac filter-group log-enable

This will result in ONLY filter 128 ("permit any any") being applied to the interface -- NOT AT ALL what you (presumably) intended.

The second tool is a lock that allows the admin to limit the number of devices that can access a given port on the switch. Unfortunately, this only sends an SNMP trap for a violation -- it does not actually disable the port or drop traffic from an unauthorized MAC address. Here's how you do it:

  conf t
  lock ethernet 15 addr-count 1

This applies a "lock" to allow only a single MAC address to eth 15 on a FES2402 switch. However, this isn't a terribly useful tool, as it only notifies the admin when someone attempts to attach an unauthorized device.

However, there is a third tool that takes the "lock" concept and gives it some teeth, so to speak. This is the MAC Port Security feature, and it can be applied either globally or directly to an Ethernet interface. Here is how you apply the MAC Port Security feature to a specific interface:

  conf t
  int eth 0/1/15
    port security
      enable
      maximum 1
      age 5
      violation restrict

In this example, we applied Port Security to Ethernet 0/1/15, enabled port security, set a maximum of 1 authorized IP address to this port, set the aging timer to drop the authorized IP address after 5 minutes (that is, if five minutes elapse without receiving a frame from a device, it will clear the MAC address entries for the interface, allowing a new device to connect), and telling the port to drop frames from any unrecognized device. You can set up to a maximum of 64 known MAC addresses per port. The aging timer can be set from zero (never time out a recognized MAC address) to 1440 minutes. The admin can choose between "restrict" and "shutdown" when a violation occurs; restrict will simply drop frames from an unknown device, whereas shutdown will disable the Ethernet interface for a specified period. If you choose "shutdown", then the next parameter is a number between 0 and 1440, where zero means shut down the port permanently, and any other number is the time to shut down the port, in minutes.

In addtion, you can manually specify allowed MAC addresses on the port, or you can configure to automatically discover and save allowed MAC addresses to the startup configuration. To manually specify an allowed MAC address:

  conf t
  int eth 0/1/15
    port security
      enable
      secure 0123.4567.89ab

This configuration manually specifies that only the device with the MAC address "0123.4567.89ab" should be allowed to access the port.

Alternatively, to have the Foundry auto-discover an allowed device, then write the MAC address to the startup configuration:

  conf t
  int eth 0/1/15
    port security
      enable
      autosave 60

This will automatically detect the MAC address of the device connected to the port and write its MAC address to the startup configuration every 60 minutes. Only that device will be allowed to connect from then on.

Wednesday, October 16, 2013

Restoring the Boot Image on a Foundry FES2402 Switch

Don't ask me how I know this...

If, by some strange alignment of the stars and planets, both the primary and secondary flash images on a Foundry FastIron Edge switch happens to get erased, AND the switch happens to be rebooted before you catch the problem, it is possible to reinstall a flash image via TFTP from the boot monitor. Here's how to do it. You know, just in case it were to happen...speaking hypothetically, of course.

When the switch reboots without a flash image, it will enter boot monitor mode. You will know it is in boot monitor mode because the prompt will say...:

BOOT MONITOR>

First, you need to assign an IP address and, if necessary, a default gateway to the switch:

BOOT MONITOR>ip address 10.1.2.3/24
Load bootp-tftp image
ip address = 10.1.2.3, subnet mask = 255.255.255.0
BOOT MONITOR>ip default-gateway 10.1.2.1
ip default gateway = 10.1.2.1
BOOT MONITOR>


Next, verify that the IP address and default gateway have been set correctly:

BOOT MONITOR>show ip
     IP address: 10.1.2.3
    Subnet mask: 255.255.255.0
Default gateway: 10.1.2.1
BOOT MONITOR>


So far, so good. Now verify that you can reach the TFTP server (don't forget to start the TFTP server!):

BOOT MONITOR>ping 10.1.2.2
Received 1 replies from remote host
BOOT MONITOR>


If you can't ping the TFTP server, find out why before proceeding. Otherwise, boot the switch from TFTP:
BOOT MONITOR>boot system tftp 10.1.2.1 FES03500.bin
BOOT MONITOR>


At this point, the switch should be running the new image, but it hasn't stored the image in flash yet. Unfortunately, you can't just write the running image to the flash drive; you have to upload it from the TFTP server again:
FES2402 SWITCH>en
FES2402 SWITCH#config t
FES2402 SWITCH(config)#ip address 10.1.2.3/24
FES2402 SWITCH(config)#exit
FES2402 Switch#copy tftp flash 10.1.2.2 FES03500.bin primary
FES2402 Switch#Flash Memory Write (8192 bytes per dot)........................
............................................................................................................
............................................................................................................
...........................
TFTP to Flash Done.
FES2402 Switch#


You should have a nice, shiny, new image in flash now. But if something didn't go right (like, I don't know, maybe you forgot to set your IP address, or you set it wrong, perhaps?), you don't want to start over from the beginning. So, before you reboot the switch, verify that you have the new image in flash:
FES2402 Switch#show flash
    Compressed Pri Code size = 2193091, Version 03.5.00Tc1 (FES03500.bin)
    Sec Code Flash Empty
    ...


You will get a lot more output than this, but as you can see from the first line of output, Version 03.5.00Tc1 (FES03500.bin) is installed in the primary flash. As long as you see that your image has been stored in the primary flash, you can reboot the switch. If you don't see it, figure out what went wrong and try again.

Do you see the image in flash, now? Good. Let's reboot the switch:
FES2402 Switch#reload
Are you sure? (enter 'y' or 'n'): y
Could not verify if the Running Config data has been changed.
Do you want to continue the reload anyway? (enter 'y' or 'n'): y
Halt and reboot

FE Boot Monitor Version 03.5.00 (BLDR-Rev1a)
Enter 'b' to go to boot monitor ...
BOOT INFO: load monitor from code flash, size = 49021
BOOT INFO: load image from primary copy
BOOT INFO: bootparam at 000228e0, mp_flash_size = 002176e3
BOOT INFO: code decompression completed
BOOT INFO: branch to 00400100
........
Crossbar initialization Done
Parsing Config Data ...
INFO: empty config data in the primary area, try to read from backup
INFO: empty config data in the backup area also

  SW: Version 03.5.00Tc1 Copyright (c) 1996-2006 Foundry Networks, Inc.
      Compiled on Mar 01 2006 at 10:06:41 labeled as FES03500
      (2193091 bytes) from Primary FES03500.bin
      Boot Monitor: Version 03.5.00Tc4
...
FES2402 Switch>en
No password has been assigned yet...
FES2402 Switch#


WOOHOO! You dodged the bullet this time! Reload your configs on the switch, and next time, be more careful!!!