Шукати в цьому блозі

Показ дописів із міткою cisco. Показати всі дописи
Показ дописів із міткою cisco. Показати всі дописи

пʼятниця, 14 грудня 2012 р.

Juniper: аналог cisco global в vrf.

Задача: вывести маршрут из vrf в глобальную таблицу (например для живущих внутри vrf sip-абонентов). Например, из vrf необходимо получить доступ к внешним ресурсам 2xx.xx.xx1.0/28, 2xx.xx.xx0.2/32 и 2xx.xx.xx0.27/32.

Описываем routing-instances:
routing-instances {
    ANOTHER_CLIENT {
        description "ANOTHER CLIENT";
        instance-type vrf;
        interface ge-1/0/1.210;
        interface ge-1/0/7.207;
        interface ge-1/1/0.209;
        route-distinguisher xxxxx:10008;
        vrf-target target:xxxxx:10008;
        vrf-table-label;
        routing-options {
            static {
                route 0.0.0.0/0 next-hop 10.255.xxx.6;
                route 2xx.xx.xx1.0/28 next-table inet.0;
                route 2xx.xx.xx0.2/32 next-table inet.0;
                route 2xx.xx.xx0.27/32 next-table inet.0;
            }
            auto-export {
                family inet {
                    unicast {
                        rib-group Export_VRF_VoiceDevice_to_inet.0;
                    }
                }
            }
        }
    }
}
На маршрут 0.0.0.0/0 не обращаем внимания, это из другой оперы, не относящейся к теме данной статьи.
После этого нарисуем policy-options который затем будет использоваться в rib-groups-е:
policy-options {
    policy-statement VoiceDevice_in_VRF {
        term vd {
            from {
                route-filter 10.255.xxx.4/30 exact;
            }
            then accept;
        }
        then reject;
    }
}
И завершающий штрих, рисуем rib-groups:
routing-options {
    rib-groups {
        Export_VRF_VoiceDevice_to_inet.0 {
            import-rib inet.0;
            import-policy VoiceDevice_in_VRF;
        }
    }
    router-id 9x.xxx.xxx.x9;
    autonomous-system xxxxx;
}

вівторок, 2 жовтня 2012 р.

Cisco vs Juniper - команды

Сравнительная таблица команд Cisco IOS и Juniper OS.
Cisco Command Juniper Command Co-Ordinating Definition
show run sh configuration Show running configuration
sh ver sh ver Show version
show ip interface brief show interface terse displays the status of interfaces configured for IP
show interface [intfc] show interfaces [intfc] detail displays the interface configuration, status and statistics.
show controller intfc show interfaces intfc extensive displays information about a physical port device
show interface | incl (proto|Desc) show interfaces description displays the interface configuration, status and statistics
show ip route show route displays summary information about entries in the routing table
show ip bgp summary show bgp summary displays the status of all Border Gateway Protocol (BGP) connections
show ip bgp net mask show route protocol bgp prefix will show you how that route is being advertised, look for the first line
show ip bgp net mask longer-prefixes show route range prefix will show you how that route is being advertised, look for the first line
show ip bgp regexp AS-regexp show route aspath-regexp "AS-regexp" displays routes matching the autonomous system (AS) path regular expression
show ip bgp neighbors neigh received-routes show route receive-protocol bgp neigh

show route source-gateway neigh protocol bgp
Shows whether a neighbor supports the route refresh capability
show ip bgp neighbor neigh advertised-routes show route advertising-protocol bgp neigh Shows whether a neighbor supports the route refresh capabilty
show clns neighbors show isis adjacency displays both ES and IS neighbors
show clns interface show isis interface shows specific information about each interface
show ip route isis show isis routes displays the current state of the the routing table
show isis topology show isis spf displays a list of all connected routers in all areas
show ip ospf interface show ospf neighbor shows neighbor ID, Priority, IP, & State if the neighbor router, dead time.
show ip ospf interface show ospf interface shows neighbor id, pri, state, dead time, address and interface
show ip route ospf show ospf route display the current state of the routing table
show ip ospf database show ospf database display list of information related to the OSPF database for a specific communication server
show version show version, show system uptime display the system hardware config., software version, and name and source of configuration files and boot images
show diags show chasis hardware displays power-on diagnostics status
show processes cpu show system process displays utilization statistics
show tech-support request support info displays the current software image, configuration, controllers, counters, stacks, interfaces, memory and buffers
show logging show log messages display the state of logging to the syslog
show route-map name show policy name displayall route-maps configured or only the one specified
show ip prefix-list name show policy name display information about a prefix list or prefix list entries
show ip community-list list configure, 
show policy-options community name
display routes that are permitted by BGP community list
show environment all show chassis  environment displays temperature and voltage information on the console
ping dest ping dest rapid (for cisco like output)
ping dest (for unix like output)
to check to see if a destination is alive
ping (setting source int) ping dest bypass-routing to check to see if a destination is alive
terminal monitor monitor start messages Change console terminal settings
terminal no monitor monitor stop Change console terminal settings
terminal length 0 set cli screen-length 0 sets the length for displaying command output
Слямзил туточки networking.ringofsaturn.com.

JunOS: BGP маршруты - advertised и received

Как это делается в Cisco IOS:
IOS# show ip bgp neighbor x.x.x.x advertised-routes
IOS# show ip bgp neighbor x.x.x.x received-routes
Как это делается в JunOS:
JUNOS> show route receive-protocol bgp x.x.x.x
JUNOS> show route advertising-protocol bgp x.x.x.x

четвер, 9 серпня 2012 р.

Простой TCL скрипт на Cisco

Предположим, что мы хотим пропинговать по порядку несколько адресов. Конечно можно отдельно для каждого адреса вызвать ping и посмотреть результаты, а можно сделать так, предварительно переключившись в режим tclsh:
foreach address {
8.8.8.8
8.8.4.4
212.90.160.2
212.90.160.8
} { puts [ exec "ping $address" ] }
Результат будет выглядеть примерно так:
router#tclsh
router(tcl)#foreach address {
+>8.8.8.8
+>8.8.4.4
+>212.90.160.2
+>212.90.160.8
+>} { puts [ exec "ping $address" ] }

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/36/40 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/36/40 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 212.90.160.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 212.90.160.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

router(tcl)#

вівторок, 24 липня 2012 р.

Аналог iperf в Cisco

Запускаем приёмник. На маршрутизаторе Cisco необходимо выполнить нижеописанные команды. Значения в скобках — значения по умолчанию, которые вступают в силу по нажатию ENTER. В настройках можно изменить окно TCP для имититации работы рабочих станций.
#ttcp
transmit or receive [receive]:
buflen [8192]:
bufalign [16384]:
bufoffset [0]:
port [5001]:
sinkmode [y]:
rcvwndsize [2144]: 4096
show tcp information at end [n]:
ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001, rcvwndsize=4096 tcp

Теперь необходимо запустить передатчик:
#ttcp
transmit or receive [receive]: trans
Target IP address: 192.168.0.254
buflen [8192]:
nbuf [2048]: 50
bufalign [16384]:
bufoffset [0]:
port [5001]:
sinkmode [y]:
buffering on writes [y]:
show tcp information at end [n]:
ttcp-t: buflen=8192, nbuf=50, align=16384/0, port=5001 tcp -> 192.168.0.254

Когда соединение установлено, приемник выводит в строке состояния сообщение о том, что связь установлена. После завершения передачи, приемник выводит статистику тестирования, которая показывает количество переданных данных, время передачи, рассчитанную пропускную способность, количество операций ввода/вывода для чтения данных:
ttcp-r: accept from 192.168.0.253 (mss 1460, sndwnd 2144, rcvwnd 4096)
ttcp-r: 409600 bytes in 61064 ms (61.064 real seconds) (~5 kB/sec) +++
ttcp-r: 301 I/O calls ttcp-r: 0 sleeps (0 ms total) (0 ms average)
Аналогичным образом передатчик делает вывод в строке состояния, когда он подключается к получателю. Когда передача завершена, передатчик показывает свою статистику:
ttcp-t: connect (mss 1460, sndwnd 4096, rcvwnd 2144)
ttcp-t: 409600 bytes in 60504 ms (60.504 real seconds) (~5 kB/sec) +++
ttcp-t: 50 I/O calls
ttcp-t: 0 sleeps (0 ms total) (0 ms average)
Дополнительно можно почитать тут http://worm.org.ua/2010/12/ttcp-iperf-cisco/

понеділок, 28 вересня 2009 р.

Cisco - два провайдера и ip sla / rtr

Итак, рассмотрим простой пример. Есть клиент и имеется два провайдера (аплинка). Автономной системы для построения BGP-peer'ов у нас нет, а работать, при падении одного каналов как-то надо. При этом у нас есть внутренний клиент нашей сети который работает не как все, а с точностью до наоборот. В нормальной (оба канала работают) этот клиент всё-равно ходит через резервный канал (Dialer1), в то время как все работают по основному (Dialer0) и переключается он на основной канал только в том случае если резервный(!) падает (бывает и такое).
Одно из возможных решений может выглядеть так:
interface Vlan1
ip address 192.168.0.1 255.255.255.0
ip policy route-map tracking
!
route-map tracking permit 10
match ip address 1
set default interface Dialer1 Dialer0
!
route-map tracking permit 20
match ip address 2
set default interface Dialer0 Dialer1
!
access-list 1 permit 192.168.0.101
access-list 2 deny   192.168.0.101
access-list 2 permit 192.168.0.0 0.0.0.255

Да, такая конструкция работает, но есть один недостаток, причём достаточно не очевидный.
Может наблюдаться такая ситуация, что и статус и протокол могут находиться в состоянии Up, а канал может не работать. Тогда эта конструкция ничем не поможет.
Что-же делать? Всё очень просто: использовать возможности sla.
Что нам для этого надо? Просто надо переписать route-map tracking и написать правила для sla.
interface Vlan1
ip address 192.168.0.1 255.255.255.0
ip policy route-map tracking
!
track 123 rtr 1 reachability
!
track 124 rtr 2 reachability
!
ip sla 1
icmp-echo 195.5.5.208 source-interface Dialer1
timeout 2000
threshold 2
frequency 3
ip sla schedule 1 life forever start-time now
ip sla 2
icmp-echo 193.34.140.1 source-interface Dialer0
timeout 2000
threshold 2
frequency 3
ip sla schedule 2 life forever start-time now
!
route-map tracking permit 100
match ip address 1
set ip next-hop verify-availability 195.5.5.208 10 track 123
set ip next-hop verify-availability 193.34.140.1 20 track 124
!
route-map tracking permit 120
match ip address 2
set ip next-hop verify-availability 193.34.140.1 10 track 124
set ip next-hop verify-availability 195.5.5.208 20 track 123
!
route-map tracking permit 200
set ip next-hop verify-availability 195.5.5.208 10 track 123
set ip next-hop verify-availability 193.34.140.1 20 track 124
!
access-list 1 permit 192.168.0.101
access-list 2 deny   192.168.0.101
access-list 2 permit 192.168.0.0 0.0.0.255

Собственно всё банально просто. ;)
route-map перестаёт отрабатывать для пакета свои правила после того как обнаружит первое-же совпадение. Поэтому, собственно, порядок определения сиквенсов важен!
Теперь если мы взглянем на состояние интерфейсов то увидим:
#sh ip int br | i ^Dialer
Dialer0                    193.34.141.151  YES IPCP   up                    up      
Dialer1                    unassigned      YES IPCP   up                    up
При этом видим, что и статус и протокол Dialer1 находятся в состоянии up, т.е. первый вариант route-map tracking не сработал бы и клиент 192.168.0.101 просто не работал бы. Но если мы взглянем на статистику по route-map tracking из второго варианта то увидим:
#sh route-map tracking
route-map tracking, permit, sequence 100
Match clauses:
ip address (access-lists): 1 
Set clauses:
ip next-hop verify-availability 195.5.5.208 10 track 123  [down]
ip next-hop verify-availability 193.34.140.1 20 track 124  [up]
Policy routing matches: 711 packets, 95929 bytes
route-map tracking, permit, sequence 120
Match clauses:
ip address (access-lists): 2 
Set clauses:
ip next-hop verify-availability 193.34.140.1 10 track 124  [up]
ip next-hop verify-availability 195.5.5.208 20 track 123  [down]
Policy routing matches: 216 packets, 14100 bytes
route-map tracking, permit, sequence 200
Match clauses:
Set clauses:
ip next-hop verify-availability 195.5.5.208 10 track 123  [down]
ip next-hop verify-availability 193.34.140.1 20 track 124  [up]
Policy routing matches: 0 packets, 0 bytes
Состояние в ip next-hop verify-availability 195.5.5.208 10 обозначено как down, а соответственно эти маршруты установлены не будут.

Всё. Вот и вся заметка. ¨Спасибы¨ принимаются в литрах ;)

пʼятниця, 19 червня 2009 р.

(comp.dcom.sys.cisco) Cisco в качестве PPTP-клиента

service internal
!
no ip gratuitous-arps ! recommended
!
ip multicast-routing
!
vpdn enable
!
vpdn-group 1
request-dialin
protocol pptp
rotary-group 0
initiate-to ip 1.1.1.1 ! target PPTP server address
interface Dialer0
mtu 1450 ! allows for mppe and one PPPoE layer just in case
!== типа фиксированно запрашиваемый ip ==
!ip address 2.2.2.2 255.255.255.252
!== получать ip от pptp-сервера ==
!ip address negotiated
ip pim dense-mode
encapsulation ppp
dialer in-band
dialer idle-timeout 0
dialer string 123 ! required, but value seems to be ignored
dialer vpdn
dialer-group 1
no cdp enable
ppp pfc local request
ppp pfc remote apply
ppp encrypt mppe auto
ppp chap hostname vpnuser
ppp chap password 0 vpnpassword
!
dialer-list 1 protocol ip permit

Ссылки по теме:
  1. groups.google.com/comp.dcom.sys.cisco
  2. www.supporting.ru