четверг, 26 апреля 2012 г.

Конфиг Cisco (функция auth-proxy)

Building configuration...

Current configuration : 3500 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime localtime
no service password-encryption
!
hostname Rezerv
!
boot-start-marker
boot-end-marker
!
no logging console
!
aaa new-model
!
!
aaa authentication login default group tacacs+ local enable
aaa authorization auth-proxy default group tacacs+
!
aaa session-id common
ip cef
!        
!
no ip dhcp use vrf connected
ip dhcp excluded-address 192.168.4.1 192.168.4.2
!
ip dhcp pool cisco
   network 192.168.4.0 255.255.255.0
   default-router 192.168.4.1
   dns-server 8.8.8.8
!
!
ip auth-proxy auth-proxy-banner http ^CPrivetstvie !!!^C
ip auth-proxy max-nodata-conns 3
ip auth-proxy inactivity-timer 1
ip auth-proxy name HQ_users http inactivity-time 60
ip admission auth-proxy-banner http ^CPrivetstvie !!!^C
ip admission max-nodata-conns 3
ip admission inactivity-timer 1
ip sla monitor 1
 type echo protocol ipIcmpEcho 10.0.0.1 source-interface FastEthernet0/1
 request-data-size 8
 timeout 1
 frequency 1
ip sla monitor schedule 1 life forever start-time now
ip sla monitor 2
 type echo protocol ipIcmpEcho 192.168.2.2 source-interface Vlan2
 request-data-size 8
 timeout 1
 frequency 1
ip sla monitor schedule 2 life forever start-time now
!
!
!
username admin privilege 15 password 0 cisco
!
!
no ip rcmd domain-lookup
ip rcmd rsh-enable
ip rcmd remote-host root 192.168.4.3 root enable
!
track 1 rtr 1
 delay down 1 up 1
!
track 2 rtr 2
 delay down 1 up 1
!
!        
!
!
interface Loopback0
 no ip address
!
interface FastEthernet0/0
 ip address 192.168.3.1 255.255.255.0
 ip flow ingress
 ip flow egress
 ip nat inside
 ip virtual-reassembly
 ip route-cache flow
 ip policy route-map backup
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.0.0.2 255.0.0.0
 ip access-group 100 out
 ip nat outside
 ip virtual-reassembly
 duplex auto
 speed auto
!
interface FastEthernet0/0/0
 switchport access vlan 2
!
interface FastEthernet0/0/1
 switchport access vlan 3
!
interface FastEthernet0/0/2
 switchport access vlan 3
!
interface FastEthernet0/0/3
 switchport access vlan 5
!
interface Vlan1
 no ip address
!
interface Vlan2
 ip address 192.168.2.1 255.255.255.0
 ip access-group 101 out
!
interface Vlan3
 ip address 192.168.4.1 255.255.255.0
 ip nat inside
 ip auth-proxy HQ_users
 ip virtual-reassembly
!
interface Vlan5
 ip address 192.168.101.161 255.255.255.0
 ip nat outside
 ip virtual-reassembly
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.101.21
!
ip flow-export version 5
ip flow-export destination 192.168.4.3 2055
!
ip http server
ip http access-class 61
ip http authentication aaa
no ip http secure-server
ip nat inside source static tcp 192.168.3.2 5000 interface FastEthernet0/1 5000
ip nat inside source static 192.168.4.3 192.168.101.162
!
logging trap debugging
logging facility local0
logging 192.168.4.3
access-list 15 permit 10.0.0.2
access-list 61 deny   any
access-list 100 deny   ip host 10.0.0.2 host 192.168.2.2
access-list 100 permit ip any any
access-list 101 deny   ip host 192.168.3.2 host 10.0.0.1
access-list 101 permit ip any any
snmp-server community parol RW 1
!
route-map backup permit 10
 match interface FastEthernet0/0
 set ip next-hop verify-availability 10.0.0.1 10 track 1
 set ip next-hop 192.168.2.2
!
!
tacacs-server host 192.168.4.3
tacacs-server key cisco
!
control-plane
!
!
banner login ^CLocal: login admin, password cisco, via Tacacs+: login dimon, password cisco^C
!        
line con 0
line aux 0
line vty 0 4
!
scheduler allocate 20000 1000
end

RSH на Сisco

Настройка RSH на cisco:

1) Создать пользователя на Cisco c уровнем доступа 15:
 R(config)#username root privilege 15 password admin
2) Настроить rsh:
 !
 no ip rcmd domain-lookup(обязательная команда)
 ip rcmd rsh-enable
 ip rcmd remote-host root(локальный username) 192.168.1.3(IP компа) root(пользователь Linux) enable
 !
3) Поставить rsh из репозитория openSUSE 11.4
4) Запустить, например:
 linux:/usr/bin# rsh 192.168.1.1 -l root sh int fa0/1
5) Для записи в файл применить >, например:
 linux:/usr/bin# rsh 192.168.1.1 -l root sh int fa0/1 > /home/dmitri/statistics.txt

Базовая конфигурация SNMP на Cisco, удалённое опускание интерфейса по SNMP

SNMP on Cisco:

1) access-list 1 permit 192.168.1.6
2) snmp-server community cisco RW 1
3) snmp-server ifindex persist
4) show snmp mib ifmib ifindex (index interface)

5) Install snmpset on Linux or Windows
6) Enter follow commands in terminal (cmd.exe):
    snmpset -v 2c -c TEXT X.X.X.X 1.3.6.1.2.1.2.2.1.7.N i {1|2}

TEXT - community string
X.X.X.X - ip address of cisco interface
N - index cisco interface
1 - up
2 - down

MIB Cisco 1841:

Rezerv#show snmp mib ifmib ifindex 
FastEthernet0/0: Ifindex = 1
FastEthernet0/0/0: Ifindex = 3
Null0: Ifindex = 7
Vlan1: Ifindex = 8
Vlan2: Ifindex = 9
FastEthernet0/1: Ifindex = 2
Vlan3: Ifindex = 10
FastEthernet0/0/1: Ifindex = 4
FastEthernet0/0/2: Ifindex = 5
FastEthernet0/0/3: Ifindex = 6

Готовые команды для использования в командной строке:
1) Уронить fa0/1: snmpset -v 2c -c parol 192.168.1.1 1.3.6.1.2.1.2.2.1.7.2 i 2
2) Поднять fa0/1: snmpset -v 2c -c parol 192.168.1.1 1.3.6.1.2.1.2.2.1.7.2 i 1
3) Уронить vlan2: snmpset -v 2c -c parol 192.168.1.1 1.3.6.1.2.1.2.2.1.7.9 i 2
4) Поднять vlan2: snmpset -v 2c -c parol 192.168.1.1 1.3.6.1.2.1.2.2.1.7.9 i 1

Настройка tftp сервера для Cisco на openSUSE 11.4

# Рабочий конфиг тфтп сервера
# Установил два пакета через yast: yast-tftp, tftp
# Создал директорию /tftpboot
# Назначил ей права:
# chmod -R 777 /tftpboot
# chown -R nobody /tftpboot


service tftp
{
#    per_source    = 11
#    cps        = 100 2
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = -c -s /tftpboot
    flags           = IPv4
    disable         = no
}

SysLog на Cisco и Linux

Настройка SysLog на Cisco и Linux (openSUSE 11.4)

Настройка на Cisco:

logging trap debugging  (с каким уровнем дебажить)
logging facility local0 (local0 - фильтр)
logging 192.168.1.2     (Сервер Syslog)
logging 192.168.1.3     (Сервер Syslog)

Настройка на Linux:

1) Поставить syslogd из репозитория openSUSE 11.4
2) Попровать конфигурационный файл /etc/syslog.conf следующим образом:
    local0.*    /home/dmitri/cisco
3) Запустить его с помощью команды:
    root:/# /sbin/syslogd -r
4) Для возможности правки файла не от рута прменить команду:
    chmod 777 /home/dmitri/cisco