Már egyszer írtam az itt található konfiguráció gyártó perl script-ről, most be is szeretném mutatni GNS3-al a működését.

A fenti linken jól le van írva, hogy a scriptet hogy kell használni. Nézzük tehát:

Először is rakjuk fel a scriptet egy olyan szerverre, vagy gépre ahol van perl. Nekem nem volt kedvem a windows-ra telepíteni, ezért a szerverünkre raktam.

A következő perl modulokra van szükség: Config::INI::Simple, Math::BigInt and Net::IP, a modulokat könnyű telepíteni CPAN-al.

Miután minden fent volt, a programot indítva a következőt láthatjuk:

configMaker: generates template router configurations from Dynagen network files

usage: configMaker -d -x -o outputDirectory -t templateFile networkFile

  -d  debugging printouts
  -x  dump parsed Dynagen file, do not produce configs
  -o  output directory, relative to current directory
  -t  template file, relative to configMaker script
 

 A program működéséhez 3 fájl szükséges:

  • configMaker: a perl script
  • configMaker.ini: itt tudjuk megadni a szükséges paramétereket ( WAN,LAN,Loopback IP címek , illetve hogy a generált konfigokat hova rakja a script)
  • simpleConfig.ini: ez a konfig template, melyben perl paramétereket helyezhetünk el, mint pl: $IP, $hostname, stb. (az oldalon jól le van dokumentálva)

 Az én simpleConfig.ini -m csak annyiban tér el az eredetitől, hogy beleraktam az eigrp-t a [common] részbe (itt adhatjuk meg azokat a paramétereket, melyek nem interface specifikusak).

router eigrp 1

 network 10.0.0.0

 no auto-summary

Ez így néz ki egyébként:

xcke@securebox:~/dyn_conf$ cat simpleConfig.ini
[Common]
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname $hostname
!
logging buffered 4096
!
ip cef
!
no ip domain lookup
!
interface Loopback0
 ip address $ip
!
ip http server
no ip http secure-server
!
$hosts
!
router eigrp 1
 network 10.0.0.0
 no auto-summary
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 transport preferred none
line aux 0
line vty 0 4
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 no login
 transport preferred none
!
ntp logging

[Serial FR]
interface $interface
 description Link to $peername
 no ip address
 no shutdown
 encapsulation frame-relay
 frame-relay lmi-type ansi
!
map-class frame-relay Keepalive
 frame-relay end-to-end keepalive mode bidirectional
 frame-relay end-to-end keepalive timer send 2
 frame-relay end-to-end keepalive timer recv 2
 frame-relay end-to-end keepalive error-threshold send 3
 frame-relay end-to-end keepalive error-threshold recv 3

[Serial DLCI]
interface $interface.$dlci point-to-point
 description Link to $peername
 ip unnumbered Loopback0
 logging event subif-link-status
 frame-relay interface-dlci $dlci
  class Keepalive

[Serial PPP]
interface $interface
 no shutdown
 encapsulation ppp
 ip address $ip

[Router link]
interface $interface
 no shutdown
 ip address $ip

[LAN]
interface $interface
 no shutdown
 ip address $ip

[LAN NIO]
interface $interface
 no shutdown
 ip address dhcp
 

Szerintem értelemszerűen lehet template konfigokat gyártani.

A script üzembehelyezése után csináltam egy példa GNS3 topológiát, és elmentettem teszt2.net néven.

 

A teszt2.net fájlt felraktam a szerveremre, és a következő parancsot adtam ki:

./configMaker teszt2.net

A script kiolvasta a fájlból a létező interface-eket, és legenerálta a konfigokat. (alap esetben a start könyvtárba rakja őket)

configMaker starting from template simpleConfig.ini output in Start

reading template
reading dynagen file teszt2.net … done

Phase II: create configs
Router: R3
  interface f1/0 (10.0.7.5 255.255.255.252) linked to R0(ROUTER) f1/0
  interface f2/0 (10.0.7.9 255.255.255.252) linked to R1(ROUTER) f2/0
  interface s3/0 () linked to FR0(FRSW) 2
    DLCI 102 linked to R1 (s3/0) DLCI 203
  interface f1/1 (10.0.7.13 255.255.255.252) linked to R2(ROUTER) f1/0
Router: R1
  interface f1/0 (10.0.7.17 255.255.255.252) linked to R2(ROUTER) f1/1
  interface f2/0 (10.0.7.10 255.255.255.252) linked to R3(ROUTER) f2/0
  interface s3/0 () linked to FR0(FRSW) 11
    DLCI 203 linked to R3 (s3/0) DLCI 102
  interface f1/1 (10.0.7.21 255.255.255.252) linked to R0(ROUTER) f1/1
Router: R0
  interface f1/0 (10.0.7.6 255.255.255.252) linked to R3(ROUTER) f1/0
  interface f2/0 (10.0.7.25 255.255.255.252) linked to R2(ROUTER) f2/0
  interface s3/0 () linked to FR0(FRSW) 10
    DLCI 202 linked to R2 (s3/0) DLCI 101
  interface f1/1 (10.0.7.22 255.255.255.252) linked to R1(ROUTER) f1/1
Router: R2
  interface f1/0 (10.0.7.14 255.255.255.252) linked to R3(ROUTER) f1/1
  interface f2/0 (10.0.7.26 255.255.255.252) linked to R0(ROUTER) f2/0
  interface s3/0 () linked to FR0(FRSW) 1
    DLCI 101 linked to R0 (s3/0) DLCI 202
  interface f1/1 (10.0.7.18 255.255.255.252) linked to R1(ROUTER) f1/0
 

Az egyik konfig például így néz ki:

!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R0
!
logging buffered 4096
!
ip cef
!
no ip domain lookup
!
interface Loopback0
 ip address 10.0.1.2 255.255.255.255
!
ip http server
no ip http secure-server
!
ip host FR0 10.0.1.1
ip host R0 10.0.1.2
ip host R1 10.0.1.3
ip host R2 10.0.1.4
ip host R3 10.0.1.5

!
router eigrp 1
 network 10.0.0.0
 no auto-summary
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 transport preferred none
line aux 0
line vty 0 4
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 no login
 transport preferred none
!
ntp logging
!
interface f1/0
 no shutdown
 ip address 10.0.7.6 255.255.255.252
!
interface f2/0
 no shutdown
 ip address 10.0.7.25 255.255.255.252
!
interface s3/0
 description Link to FR0
 no ip address
 no shutdown
 encapsulation frame-relay
 frame-relay lmi-type ansi
!
map-class frame-relay Keepalive
 frame-relay end-to-end keepalive mode bidirectional
 frame-relay end-to-end keepalive timer send 2
 frame-relay end-to-end keepalive timer recv 2
 frame-relay end-to-end keepalive error-threshold send 3
 frame-relay end-to-end keepalive error-threshold recv 3
!
interface s3/0.202 point-to-point
 description Link to R2
 ip unnumbered Loopback0
 logging event subif-link-status
 frame-relay interface-dlci 202
  class Keepalive
!
interface f1/1
 no shutdown
 ip address 10.0.7.22 255.255.255.252
 

A konfigokat ezután a GNS3 könyvtárába másoltam, és megadtam minden router-nek hogy startup-config-ként a megfelelő fájlt használja, és hurrá működik is, nem kellett fél órán át az alap konfigokat készíteni, lehet értelmesebb feladatokra koncentrálni.

 

Popularity: 56% [?]

Related posts:

  1. Dynagen config maker Érdekes lehet, még nem próbáltam de mindenképp ki fogom. Letöltés,leírás...
  2. DynConfig This page is a GNS3/Dynamips startup-config generator. You can upload...
  3. GNS3 újdonságok A 0.5-s verzió teljesen stabil, jól használható. Készült egy szép...
  4. Configuration lock  Hi,  Most csak röviden szeretnék írni egy kissebb "problémáról". Egy...
  5. GNS3/Dynamips configMaker web frontend Létrejött egy új link, DynConf néven. A GNS3-ban összerakott topológiát...