Monday, March 29, 2010

xos – NetLogin w/ Local MAC Authentication

# --------------------------
# unconfigure switch and reboot
# --------------------------

unconfigure switch all
y

# --------------------------
# answer the questions after the reboot
# --------------------------

n
n
y
n
n


# --------------------------
# create local variables
# --------------------------

enable cli scripting
set var targetPort     $READ(Please enter the port to which the PC is connected:)
set var userVLAN       $READ(Please enter the name for the user VLAN:)
set var ipAddressMask  $READ(Please enter the IP address and mask (xxx.xxx.xxx.xxx xx) for the user VLAN:)
set var netLoginVLAN   $READ(Please enter the name of the Net Login VLAN:)
set var pc_mac_address $READ(Please enter the MAC address of the PC to be used for this exercise:)
set var pc_mac_address XX:XX:XX:XX:XX:XX 


# --------------------------
# disable all ports and remove all ports from default vlan
# --------------------------

disable ports all
configure vlan default delete port all


# --------------------------
# setup default vlan to support the NetLogin Client
# --------------------------

configure vlan default add port $targetPort
enable $targetPort
unconfigure vlan default ipaddress
configure vlan default ipaddress $ipAddressMask
configure snmp sysname $systemName
save configuration $systemName
y
n


# --------------------------
# configure netlogin vlan
# --------------------------

# Create a VLAN to support the Network Login service.
create vlan $netLoginVLAN

# Associate the VLAN to the Network Login Service.
configure netlogin vlan $netLoginVLAN


# --------------------------
# configure MAC address authentication
# --------------------------

# enable the netlogin mac service
enable netlogin mac

# configure system to use the local auth. database
configure netlogin mac authentication database-order local

# enable the netlogin service on a port
enable netlogin $targetPort mac


# --------------------------
# add mac address to local database

# --------------------------


# Add the MAC addresses to the local database. MAC addresses are
# entered using the colon as a separator. For example, 00:00:05:00:FB:01.
configure netlogin add mac-list $pc_mac_address

# Add MAC-based users to the local database. When entering the following
# command, you will substitute the user-name and password options with the
# MAC address of the IP phone. When entering the MAC address, enter the MAC
# address used in the last step, omitting the colon (:) character. For
# instance, the MAC address from the example above would be entered as
# 00000500FB01.

create netlogin local-user $macuser-name $macuser-password