Quantcast
Channel: THWACK: Message List - Network Configuration Manager
Viewing all articles
Browse latest Browse all 8827

NCM Script to Change DHCP Scope on Cisco Routers

$
0
0

Hi all,

 

Has any one got a Script that will run on NCM to change the DCHP scope based on the IP of VLAN 1 etc. I have a script based on access list but not DHCP.

 

 

script BaseChangeTemplate(NCM.Nodes @ContextNode)

 

{

 

    string @newVlanIP = '' //changed

 

    foreach (@interfaceItem in @ContextNode.Interfaces)

 

{

 

     if (@interfaceItem.InterfaceDescription contains 'VLAN1')

 

     {

 

 

 

         foreach(@ip in @interfaceItem.IpAddresses)

 

         {

 

 

 

             @newVlanIP = setoctet(@ip.IPAddress,4,0)

 

         }

 

      }

 

}

 

if(@newVlanIP != '') // added it

 

{

 

CLI

 

{

 

conf t

 

no access-list 100

 

!

 

access-list 100 deny   ip @newVlanIP 0.0.0.255 10.124.0.0 0.3.255.255

 

access-list 100 permit ip @newVlanIP 0.0.0.255 any

 

!

 

no access-list 101

 

!

 

access-list 101 permit ip 192.168.251.0 0.0.0.127 @newVlanIP 0.0.0.255

 

access-list 101 deny   ip @newVlanIP 0.0.0.255 any

 

!

 

no access-list 104

 

!

 

access-list 104 permit ip @newVlanIP 0.0.0.255 10.124.0.0 0.3.255.255

 

}

 

}

 

}

 


Viewing all articles
Browse latest Browse all 8827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>