Tcl script to change access vlan based on MAC address

Hello all.  I'm looking for some input on how best to handle this situation. I have a large nework with a lot of remote offices where we have limited control over users moving around patch cables. We're using vlan-based QoS in these office to mark voice, video, data. etc. The problem I'm having is that our users are moving video conferencing equipment to different interfaces on our swithes, which puts the VTC unit in a different vlan, fouling our QoS policy.  They then call and complain about poor video quality.
I'm trying to come up with a way to automate putting the interface in the video vlan if a VTC unit is connected. All of our video conferencing units are from the same vendor, so they have same OUI in the MAC address. The script I've been working on looks for a line protocol up event, then checks to see what access vlan is configured on the interface. If the interface is already in the video vlan, the script exits.  if the interface is not in the video vlan, the script looks at the MAC address table for the interface and if the OUI matches a VTC unit, the script changes interface configuration. My question is, is there a better event to trigger script execution? Maybe a MAC notification trap, or something else? Line protocol transitions when the access vlan is changed, so the current script runs twice: once when the interface first comes up with a new connection, and again when the vlan is changed. 
Script is attached.  Any help or advice is appreciated!

Does your video equipment use CDP?  If so, then you can use the neighbor-discovery event detector to only react when you see a media endpoint being connected to a port.  Yes, MAC address notifications (the mat ED) can also work if you know the MACs of your media endpoints.

Similar Messages

  • Script to Change WINS IP based on current address.

    Hello everyone! I've been looking online for help on changing the primary and secondary WINS addresses on hundreds of servers. I've come across scripts that will set the WINS addresses for all enabled NICS on servers listed in a .txt file. But I don't want
    it to set WINS address on adapters on our backup network. Long story short, here's what i need:
    PowerShell script that will:
    1. Change the Primary and Secondary WINS addresses on servers from a .txt (or .xlsx) file. 
    2. Makes the change by querying the enabled adapters on the server that already have a specific IP address defined for WINS.
    Here is an example of what I need (I don't know who the original author of this is to give proper credit.) It does what I want for DNS, but need it modified for WINS only. I really appreciate anyone's suggestions!
    #------------begin script-----------------------------
    $ScriptPath        = Split-Path $MyInvocation.MyCommand.Path 
    $oldDNS         = "Enter IP Address Here"        # Old DNS you want replaced
    $newDNS         = "Enter IP Address Here"        # New DNS server you want
    $List             = $ScriptPath + "\list_server.txt"        
    $log             = New-Item -ItemType file -Path $ScriptPath -name change_DNS.csv -Force        
    Add-Content -Path $log -Value "Servers;Status"
    [array]$List = get-content $List 
    for($i=0; $i -lt $List.Length; $i++) 
        $Server =$List[$i]
        Write-Progress -Activity "Modifying DNS records" -Status "Server: $Server"
        $ping = new-object System.Net.NetworkInformation.Ping
        $Reply = $ping.send($Server)
        if ($Reply.status –eq “Success”)
            $colItems = get-wmiobject -class "Win32_NetworkAdapterConfiguration" -namespace "root\cimv2" -computername $Server | Where-Object {$_.IPEnabled -eq "True"}
                foreach ($objItem in $colItems)
                     $strDNSServerSearchOrder = $objItem.DNSServerSearchOrder
                     $dnsexists = $strDNSServerSearchOrder -Contains $oldDNS
                     if ($dnsexists -eq "True")
                        $newArrDNS = $strDNSServerSearchOrder -replace ($oldDNS,$newDNS)
                        $objItem.setDNSServerSearchOrder($newArrDNS) | out-null
                        Add-Content -Path $log -Value "$($Server);A replacement has been made"
                    else {Add-Content -Path $log -Value "$($Server);No Replacement criteria found"}
        else {Add-Content -Path $log -Value "$($Server);Offline or no ping"}
        $Reply = ""
    #------------End script--------------------------

    Yes Bill I did, but didn't find exactly what I was looking for. Oddly enough though, I started searching by "PowerShell Get WINS servers" and I came across something that helped. I ended up using this:
    # here is where I read from the list of servers, this makes the entire list a variable
    $servers = Get-Content C:\Scripts\PS-Scripts\WINS\Test.txt
    Get-wmiObject Win32_networkadapterconfiguration -computername $servers -Filter 'IPEnabled=TRUE and DHCPEnabled=FALSE' | # This filter will make sure the NIC is enabled and DHCP is disabled
    ForEach-Object{ # here is where the list goes through individual objects (or servers)
    IF($_.WINSPrimaryServer -ne $null)
    { # My list shouldn't include any servers with the Primary WINS server set but as a fail-safe this IF statement will catch it if it set
    $_.SetWINSServer("123.123.123.123","123.123.123.123") # If a server has meets all the requirements Here is where I change set the New WINS server address
    From Networksteve.com. It looks like JRV may have originally contributed to the answer on that site, so i'll give him the credit for answering. Thanks both of you for your help!

  • Creating NAC remediation rules based on MAC address

    Hi All,
    Any idea please. Is it possible to control PCs allowed on the network based on MAC address list in NAC? I.e Create a list of MAC addresses for PCs on my network in NAC; then each pc granted network access (passed NAC authentication and remediation) on the network only if its MAC address is in that list.
    So my checks will be:
    1. Have antivirus updated
    2. Have antispyware updated
    3. Have windows updates installed
    4. Have MAC address registered in the MAC list
    5. etc.
    Then after the above checks pass --> GRANT network access.
    regards,
    Stanlaus.

    I have been doing some of this, and while it does provide some of the functionality that is lost without the ability to apply rules only to read messages, it is not a complete solution. One of the biggest drawbacks is that it is not easy to selectively limit what new mail shows up the smart mailbox. One approach that works, sort of, is to limit the smart mailbox to only messages from people in my address book. However, not all relevant messages are from people already in my mailbox, so it requires constantly double checking to make sure that things are slipping through the cracks.
    The best thing about being able to apply rules, after receiving them, based on the status of a message is that it puts the control in the users hands. It allows you to selectively apply rules, only when you want to apply them. Rather than always/never, you have the ability to apply rules "sometimes/as needed." It allows for fuzzy logic, rather than hard conditions.

  • SG300 inter-VLAN routing and MAC address changes in incoming packets

    Hello
    I have SG300-20 working in Layer3 mode
    VLAN1 is not used
    Internet gateway is in VLAN211
    Clients are in other VLANs
    Switch is default gateway for clients and itself has internet gateway as default route.
    MAC address of switch is XX:XX:XX:XX:XX:63
    When client sends trafic to Internet destination MAC address in outgoing packets is XX:XX:XX:XX:XX:63
    But in incoming packets source MAC address is XX:XX:XX:XX:XX:69
    Why does it change? And how can I setup switch to use only XX:XX:XX:XX:XX:63 MAC address?

    Hi Robert,
    I'd like to pick up this old thread because we have a huge problem with the behavior of the SG300 router/switch regarding the "spoofed" MAC source addresses. We have connected this switch to another router which has some special routing capabilities. It routes certain IP packets directly to MAC addresses which it learned from snooping on special traffic.
    When connected to a SG300 router with an Ethernet base address of XX:XX:XX:XX:XX:48 we receive packets with Ethernet source addresses like e. g. XX:XX:XX:XX:XX:49 or XX:XX:XX:XX:XX:4D (depending on which hardware port they came from). Our special router "learns" these MAC addresses and tries to send associated outgoing packets directly to these addresses using e. g. XX:XX:XX:XX:XX:49 as the MAC destination address.
    Our problem is that the SG300 does not forward the packet if the MAC destination address is not equal to the switch's Ethernet base address (XX:XX:XX:XX:XX:48 in our case). This renders the SG300 series useless for our systems.
    Is there new firmware available which fixes this problem for us? We don't care which MAC source address the SG300 uses in incoming packets we receive, but we expect that the SG300 handles packets correctly for outgoing packets we send with this MAC address as the destination address.
    Thanks,
    Chris

  • VLAN Select - Interface dirty - Index based on Mac Address

    Hello Experts,
    we are testing the VLAN Select Feature with a 5508 controller, version 7.0.230 and two /23 DHCP Scopes on an external dhcp server. Our cookbook is following document:
    http://www.cisco.com/en/US/products/ps10315/products_tech_note09186a0080bb4900.shtml
    Now i have a few questions
    1 - Is there any chance to see the calculated index based on the Mac Address to which the interface is assigned to the client. I try "debug client MAC-ADDRESS" and "debug dhcp", Maybe i overlook it, but i can't find any information to that index.
    2 - Is there a cli command to delete the index? It would be great for testing purposes and troubleshooting.
    3 - Is there a cli command to look, if the interface is "dirty"?
    4 - Our DHCP Server has a lease time of 5 Minutes. Is it possible to set the interface dirty time to a value less than 30 minutes?
    Best Regards,
    Michael

    I know this is an old post - but I ran across it trying to find an answer to the same questions.
    Did you ever find any answers?  I did find an answer to question 3, show interface group detailed.
    But I haven't found a way to delete the indexes short of rebooting all the controllers, and apparently you would have to reboot them all at the same time.

  • IAS authentication with 200 series switches based on MAC addresses

    Hi,
    I try to implement a solution based on a 2003-Server with IAS and a switch (from the 200 series) just to authenticate machines with their MAC addresses.
    I think the config on the switch is ok but I'm facing questions about parameters to put in IAS...
    Can someone help me or give me a link to a good document that explains the 'how-to'?
    Many thanks

    I have just done some more testing.
    I added the authentication mac-move permit command to the switch and it now almost works as expected.
    The scenarios now are:
    Machine without dot1x supplicant plugged into phone, when unplugged the switch immediately deletes the mac address from the port.
    Machine with dot1x supplied plugged into phone, exactly the same.
    Machine without dot1x plugged directly into port exactly the same
    Machine with dot1x plugged directly into port exactly the same.
    The problem is if someone has a machine running a dot1x supplicant and hosting a VM.
    In that case as long as you move to a different port on the same switch it works fine (as the workstation reconnects the mac-move process works).
    If you move this machine from one switch to another with the IP phone installed. the de-auth message removes the VM or the host from the original switch mac table and leaves one of the old addresses behind.
    I suppose a solution would be to ban all VMs but that won't go down well.
    I don't want to change the authentication method as we will have machines without a supplicant that need to connect to resources (i.e. using mab)
    Thanks for your help (and a faster reply than my support company who still haven't rung me back).
    Giles

  • TP 60 Access connection - Preferred AP MAC address disabled permanently

    I have at home WiFi Router and WiFi repeater. They both are visible, but Router has weak signal, Repeater strong signal. TP not like to connect to Repeater. Problem, that preferred AP MAC address field is always disabled in Connection wizard (profile).
    Access Connection v.5.72 - last recommended for my PC. WiFi adapter 11 a/b/g/n/ Wireless LAN Mini-PCI Express Adapter (Atheros Communication Inc), driver 2.0.0.75
    Any idea?

    OS - Win7 Pro 32 bit

  • Dynamic Vlan assignment by Mac address SF300-48P

    We are trying to configure a Cisco SF300-48P so that when we plug in a specific manufactures device the port is set to a specific VLAN.
    We have configured mac address groups and assigned the groups to the required VLANs but when we plug the devices in the auto assignment does not appear to be occurring ie. the specified vlan does not come up.
    Anybody any ideas?
    Thanks

    i would really like to know how to do this as well
    ive downloaded and installed packetfence but it doesnt have this type of switch on the list, only catalyst series
    did you ever get it figured out Andrew?

  • HSRP - Duplicate address on Vlan, sourced by mac-address

    Hi ,
    Network structure
    Switch A --- Customer firewall 1
       |                
    Switch B  --- Customer firewall2
    May be some one can help me.
    There was a nagious alert yesterday and on investigation I found the 'Duplicate address x.x.x.x(VIP) on Vlanxxx, sourced by 0006.b19c.c5d9' error
    It a HA feed from our switches which is going to customer firewalls.
    On further investigation I have found on our switch A the ARP table is not learning the VIP address from this mac-address where as on switch B is learning the VIP address through mac 0006.b10c.c8d9 which is customer sonic firewall which is not a normal behaviour.   
    Our switches are Cisco 3560 switch.
    Please if you could let me know what causing this.

    Hi mcgowan,
    Yes, there is duplicate MAC. But, its duplicate between interface vlan address and virtual MAC address on HSRP.
    when I type command :
    show mac address | i 0000.0c07.ac01
    It shows me :
    100    0000.0c07.ac01    STATIC      CPU
    I think this MAC generate by system on HSRP. Currently I shutdown interface vlan 100 on switch A, like as your suggestion. But the impact is my client will get trouble when switch B is down, because HSRP is not running well.
    Regards,
    Rakhmad

  • DHCP to send different Gateways based on MAC-Addresses

    Hello,
    I would like to use the built-in DHCP server to send out different Gateways based on the clients' MAC-Addresses.
    I have already managed to assign "static" IP-Adresses using the DHCP server to specific MAC-Adresses.
    Is this possible or do I need additional software ?
    thanks for your help

    The basic IP networking construct here is the IP subnet (and the subnet mask); that's how you set up groups of related network hosts in an IP network. Hosts within a subnet tend to have the same DNS and gateway router and related pieces configured, and one DHCP server and such. (That's not strictly necessary, but...)
    Launch Server Admin, select the DHCP service, set up subnets via the DHCP service by subnet mask, and establish DNS and default router settings there for each of the subnets.
    Then set up static maps for the MAC address(es) associated with the hosts, and drop the static IP addresses into the particular subnet you want the host associated with.
    You will want to leave room in the subnet for both the DHCP allocations (if any) and for the static hosts mapped into the subnet via MAC address.
    There well may be a better way here, but this will get you where you want. (And the Network Services Administration manual - which you'll need to read - does seem a bit confusing around this particular sequence.)
    nb: I don't have a "scratch" Leopard Server configuration handy to test and confirm this sequence.
    nb: Xserve boxes require a little extra thought, given each Xserve box tends to have four MAC addresses.

  • User Control System based on MAC address?

    I wonder how can I make a user control system for my website based of visitor's computer's MAC addresses?
    Is it possible to get MAC address of visitors of my site in FLASH? If possible how?
    Thanks for reply in advance

    Not possible through flash player. You may advocate javascript approach and use it in combination with Flash.

  • Script for changing objects presence based on amount range

    Hello,
    Is there a way to change an objects presence (either a field or a subhead) based on the entered amount range in a numeric field? 
    For example:
    -The numeric field amount entered is a range between 1 and 49,999, then "Signature Subhead 1" appears.
    -The numeric field amount entered is a range between 50,000 and 250,000, then "Signature Subhead 2" appears.
    Etc.
    Any advice for this script would be appreciated.
    Thanks!

    Hi Bruce,
    Your solution worked perfectly.  If I was to expand the ranges (let's say to three ranges), would I just have to add another "case this" logic section such as this?
    switch (true)  
    case this.rawValue >= 1 && this.rawValue <= 49999:  
      SignatureSubhead1.presence = "visible";  
      SignatureSubhead2.presence = "hidden";
      SignatureSubhead3.presence = "hidden"; 
      break;  
    case this.rawValue >= 50000 && this.rawValue <= 249999:  
      SignatureSubhead1.presence = "hidden";  
      SignatureSubhead2.presence = "visible";
      SignatureSubhead3.presence = "hidden";    
      break;
    case this.rawValue >= 250000 && this.rawValue <= 500000:    
      SignatureSubhead1.presence = "hidden";  
      SignatureSubhead2.presence = "hidden";
      SignatureSubhead3.presence = "visible";    
      break;  
    default:  
      SignatureSubhead1.presence = "hidden";  
      SignatureSubhead2.presence = "hidden";
      SignatureSubhead3.presence = "hidden";   
    Appreciated,
    Eric

  • Is there a script to change paragraph style based on even/odd page

    Is there a script or way to have paragraph style change between 2 styles based on the text being on an even or odd page? 

    @JustMikey – as I understand your task, the problem has nothing to do with "special" paragraph styles, but (nearly) all with anchored objects (the images and parts of the gray bar) and appropriate margin settings.
    Just see the following IDML file I exported from InDesign CS5.5:
    Dropbox - ImagesAwayFromSpine-CS5.5.zip
    ImagesAwayFromSpine-CS5.5.zip
         ImagesAwayFromSpine-CS5.5.idml
         080731_Manchester-xxl_Grau.tif
    Of course you could add paragraph styles to format the data automatically or optimize in other ways.
    That's up to you. But you can see the principle:
    Inspect the Anchored Object Options for the image and the gray bar. Also the frame fitting options for the image.
    Note: See also the margin settings, that are not exactly mirrored on even and odd pages (for good reason).
    Uwe

  • Calculation Script to change a number based on quantity in another

    Hello - and thanks for the help - I have no real idea of what I am doing when it comes to writing script.  I would like the cost of something to change depending on the quantity ordered... ie. the more you buy the better price you get.
    (ie.  5 or less = $18.00, 6-10 = $17.00, 11+ = $16.00)
    How do I write a calc script to accomplish this?  Also, if the "Quantity" affecting the outcome is a result of a calculation itself will the code still work?
    I have uploaded a sample to the following:
    http://www.shupaca.com/Calc.html
    Thanks!

    Check the spelling of you field names with in your custom scripts.
    Some overall observations:
    Use the provided formats for fields unless you want to write your own format code,  validation code, or keystrokes code.
    Use the default value option to set default values of fields, so if the form is reset, the default value is restored. You can also access this value in code.
    Use the 'read only' parameter to lock field you do not want users of the form to update.
    Check the JavaScript console for errors. You misspelled the field name.
    Do not use a calculation event when another type of event can perform the same script,. Calculation order can become a problem. All field calculations are rerun when ever any field that is used in a calculation is updated, so by the end of your form you may have a significant amount recalculation of unnecessary calculations being performed.
    Setting the 'Scarf Cost' field to read only, default value of 18, and a 'Number' format with 2 decimal places and the "$" currency symbol and removing all scripts for this field, one could use the following "On Blur' action for the 'Scarf Quantity' field:
    var oPrice = this.getField('Scarf Cost');
    oPrice.value = oPrice.defaultValue;
    if (event.value > 5) {
    oPrice.value = 16;

  • Script to change fill color based on excel data?

    Hi.  I'm curious if there is a way to change the fill color of, say a rectangle, in Illustrator based on data in an excel spreadsheet (csv or whatever).  For example: say the data in the excel cell is 1 and that corresponds to the rectangle in Illustrator having a yellow fill...  Now say I update the data in the cell to 2 and save.  I run the script and it makes the box red.  Is that even remotely possible?  Thanks.

    Hi, yes it's possible, I used VBA on Windows
    Assuming you have an Illustrator file with 1 square, and 2 swatches named "yellow" and "red"
    this is how I set up the excel file
    type the formula in cell F2 as shown, make your color updates on cell E2
    VBA code:
    Sub recolorSquare()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        Dim rect As Illustrator.PathItem
        Dim whatColor As String
        whatColor = range("F2")
        Set idoc = iapp.ActiveDocument
        Set rect = idoc.PathItems(1)
        rect.FillColor = idoc.Swatches(whatColor).Color
        Set rect = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub

Maybe you are looking for

  • Total size of all columns

    Hi , I created a table as below create table my_tab(no number(10), name varchar2(20)); Now i need to get the total no of size of this table i.e no size is 10 name size is 20 total is 30 pls give me a query to get the total size as 30. Thanks, Oracle

  • Can i get personal hotspot for ipod touch

    can i get personal hotspot on ipod touch

  • Problem of JTable's column setPreferredWidth.

    Hi All, I have a problem about JTable,I want to set the preferredwidth for every column when the table is first established,but it is always failed. Could someone tell me the root?Thanks! import java.awt.*; import javax.swing.*; public class MixerTes

  • Could not access network location error 1606

    Hello, I have my VB 6.0 Application and make a Exe and I hosted it on my windows server 2000 it gives me below image error. earlier when there was Datepicker control was used then also there was error coming but I had registered MSCOMCTL2.dll and tha

  • Making global objects

    Hi all, What i need to do is, create an object of one particular class and then access it from everywhere else in that package. That particular object should be only one instance. So when i update it at some place that is reflected when that object i