{"id":4401,"date":"2019-03-05T13:24:14","date_gmt":"2019-03-05T12:24:14","guid":{"rendered":"https:\/\/nil.uniza.sk\/?p=4401"},"modified":"2019-03-05T23:04:15","modified_gmt":"2019-03-05T22:04:15","slug":"tclsh-examples-how-to-generate-loop-interfaces","status":"publish","type":"post","link":"https:\/\/nil.uniza.sk\/en\/tclsh-examples-how-to-generate-loop-interfaces\/","title":{"rendered":"Tclsh script examples: how to generate router loop interfaces with IPv4 addresses"},"content":{"rendered":"<p>This example shows how to generate 254 loop interfaces with assigned ipv4 addresses 172.16.0.1\/24 up to 172.16.255.1\/24.  The code is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enable\ntclsh\nfor {set i 0} {$i &lt; 256} {incr i} {\nios_config \"int loop $i\" \"ip address 172.16.$i.1 255.255.255.0\"\n}\nios_config \"end\"\ntclquit<\/code><\/pre>\n\n\n\n<p>and you may just simply copy and paste it into a Cisco router CLI. Therefore first run tclsh within of privileged EXEC mode  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enable\ntclsh<\/code><\/pre>\n\n\n\n<p>and paste the code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>R3(tcl)#\n\nR3(tcl)#for {set i 0} {$i &lt; 256} {incr i} {\n+>(tcl)#ios_config \"int loop $i\" \"ip address 172.16.$i.1 255.255.255.0\"\n+>(tcl)#}\n\nR3(tcl)#<\/code><\/pre>\n\n\n\n<p>the router starts immediatelly genereate interfaces<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*Mar  1 00:01:57.083: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback176, changed state to up\n*Mar  1 00:01:57.087: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback177, changed state to up<\/code><\/pre>\n\n\n\n<p>We may check it how it proceeed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>R3#sh ip int brief\nInterface                  IP-Address      OK? Method Status                Protocol\nFastEthernet0\/0            unassigned      YES DHCP   up                    up\nSerial0\/0                  unassigned      YES NVRAM  administratively down down\nFastEthernet0\/1            unassigned      YES NVRAM  administratively down down\nSerial0\/1                  unassigned      YES NVRAM  administratively down down\nSerial0\/2                  unassigned      YES NVRAM  administratively down down\nSerial0\/3                  unassigned      YES NVRAM  administratively down down\nLoopback0                  172.16.0.1      YES unset  up                    up\nLoopback1                  172.16.1.1      YES unset  up                    up\nLoopback2                  172.16.2.1      YES unset  up                    up\nLoopback3                  172.16.3.1      YES unset  up                    up\n...<\/code><\/pre>\n\n\n\n<p>How to delete them? Just put<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enable\ntclsh\nfor {set i 0} {$i &lt; 256} {incr i} {\nios_config \" no int loop $i\"\n}\nios_config \"end\"\ntclquit<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>This example shows how to generate 254 loop interfaces with assigned ipv4 addresses 172.16.0.1\/24 up to 172.16.255.1\/24. The code is: and you may just simply copy and paste it into a Cisco router CLI. Therefore first run tclsh within of privileged EXEC mode and paste the code: the router starts immediatelly genereate interfaces We may&#8230;<\/p>","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[697,701],"tags":[984,985,1011,1010,1009],"class_list":["post-4401","post","type-post","status-publish","format-standard","hentry","category-ccna-en","category-ccnp-en","tag-ccna","tag-ccnp","tag-cisco","tag-examples","tag-tclsh"],"taxonomy_info":{"category":[{"value":697,"label":"CCNA"},{"value":701,"label":"CCNP"}],"post_tag":[{"value":984,"label":"ccna"},{"value":985,"label":"ccnp"},{"value":1011,"label":"cisco"},{"value":1010,"label":"examples"},{"value":1009,"label":"tclsh"}]},"featured_image_src_large":false,"author_info":{"display_name":"palo73","author_link":"https:\/\/nil.uniza.sk\/en\/author\/palo73\/"},"comment_info":8,"category_info":[{"term_id":697,"name":"CCNA","slug":"ccna-en","term_group":0,"term_taxonomy_id":695,"taxonomy":"category","description":"","parent":695,"count":12,"filter":"raw","cat_ID":697,"category_count":12,"category_description":"","cat_name":"CCNA","category_nicename":"ccna-en","category_parent":695},{"term_id":701,"name":"CCNP","slug":"ccnp-en","term_group":0,"term_taxonomy_id":699,"taxonomy":"category","description":"","parent":695,"count":8,"filter":"raw","cat_ID":701,"category_count":8,"category_description":"","cat_name":"CCNP","category_nicename":"ccnp-en","category_parent":695}],"tag_info":[{"term_id":984,"name":"ccna","slug":"ccna","term_group":0,"term_taxonomy_id":982,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":985,"name":"ccnp","slug":"ccnp","term_group":0,"term_taxonomy_id":983,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":1011,"name":"cisco","slug":"cisco","term_group":0,"term_taxonomy_id":1009,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":1010,"name":"examples","slug":"examples","term_group":0,"term_taxonomy_id":1008,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":1009,"name":"tclsh","slug":"tclsh","term_group":0,"term_taxonomy_id":1007,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/4401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/comments?post=4401"}],"version-history":[{"count":0,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/4401\/revisions"}],"wp:attachment":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/media?parent=4401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/categories?post=4401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/tags?post=4401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}