NTP - overload con porte > 1024

Configurazioni per connettività ADSL, ISDN e switch per privati e piccole network

Moderatore: Federico.Lagni

Rispondi
Rocco83
n00b
Messaggi: 3
Iscritto il: dom 15 gen , 2012 10:28 pm

Ciao a tutti,

dopo tanto tempo torno da voi... Ho provato ma l'unica soluzione che ho trovato non mi piace.
Prima di tutto:
Device Cisco 877.

Descrizione del problema:
ntpd (isc, http://www.ntp.org), in LAN.
Ho più di un server / client che si collega ad internet per sincronizzare la data.
Devo sincronizzare 2 diversi server interni verso NTP in esterno, per gli altri posso anche soprassedere.
Il demone ntp ha due limitazioni:
1) quando genera una nuova connessione, la crea sempre con porta sorgente 123
2) come server, accetta connessioni dalla porta sorgente 123 o >=1024
Ad esempio, inrim.it (ex ien.it) usa isc ntp, così come tanti altri server in giro per il mondo.
http://bugs.ntp.org/show_bug.cgi?id=2174 (anche se il bug è vecchio, anche l'ultima versione di jessie non è patchata secondo i miei test)
https://groups.google.com/forum/#!msg/c ... IUuXPQJDAJ

La parte interessante è il fatto che Cisco per l'overload usa il seguente algoritmo:
1) se la porta sorgente è libera, la usa
2) se la porta sorgente NON è libera, usa la prima porta disponibile in range predefiniti in base alla porta sorgente originaria:
--
Note: For Transmission Control Protocol (TCP) and User Datagram Protocol (UDP), the ranges are: 1-511, 512-1023, 1024-65535. For Internet Control Message Protocol (ICMP), the first group starts at 0.
--
Ref: http://www.cisco.com/c/en/us/products/c ... ba55a.html

Ne consegue che solo il primo server che prova a recuperare un indirizzo riesce a collegarsi ai server ntp, il secondo userà una porta "bassa", diciamo tra porta 1 e 10.

Soluzione che ho implementato:
https://www.reddit.com/r/Cisco/comments ... ort_range/
Ho aggiunto un nat statico per ogni porta compresa tra 1 e 1023, in questo modo risultano "occupati" e non vengono utilizzati dal sistema.


Ma quello che ho cercato di fare è implementare il tutto secondo questa guida:
http://www.cisco.com/c/en/us/td/docs/io ... t4pat.html
Senza successo. I sistemi continuano ad utilizzare le porte del primo range.

Configurazione di prova non funzionante:
---
conf t
access-list 123 permit udp any any eq ntp
ip nat portmap NTP
appl udp-rtp startport 1024 size 2048
exit
ip nat inside source list 123 interface Dialer0 overload portmap NTP
end
---

running-config:
!
version 12.4
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service internal
!
hostname 877-ent
!
boot-start-marker
boot system flash:c870-advipservicesk9-mz.124-24.T6.bin
boot-end-marker
!
logging message-counter syslog
logging buffered 51200 warnings
enable secret 5 $1$SORj$0tH44PS69VKqYlb/UWArz.
!
no aaa new-model
!
crypto pki trustpoint TP-self-signed-1659086078
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-1659086078
revocation-check none
rsakeypair TP-self-signed-1659086078
!
!
crypto pki certificate chain TP-self-signed-1659086078
certificate self-signed 01
[...]
quit
dot11 syslog
ip source-route
!
!
!
!
ip cef
ip domain name ********
ip name-server 172.16.8.1
ip name-server 172.16.8.7
ip name-server 172.16.8.3
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
username admin privilege 15 secret 5 **********
!
!
!
archive
log config
hidekeys
!
!
ip scp server enable
!
!
!
interface ATM0
no ip address
no atm ilmi-keepalive
dsl noise-margin 3
dsl bitswap both
!
interface ATM0.1 point-to-point
description $ES_WAN$
pvc 8/35
vbr-nrt 768 768
tx-ring-limit 3
encapsulation aal5mux ppp dialer
dialer pool-member 1
!
!
interface FastEthernet0
!
interface FastEthernet1
switchport mode trunk
!
interface FastEthernet2
switchport mode trunk
!
interface FastEthernet3
switchport mode trunk
!
interface Vlan1
description $ETH-SW-LAUNCH$$INTF-INFO-HWIC 4ESW$$ES_LAN$
ip address 172.16.8.251 255.255.255.0
ip access-group 102 in
ip nat inside
ip virtual-reassembly
ip tcp adjust-mss 1452
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 3pxnT2rFzDb2Qjtm
ip ospf priority 2
!
interface Vlan6
ip address 172.16.6.254 255.255.255.0 secondary
ip address 192.168.1.254 255.255.255.0
ip access-group 106 in
ip nat inside
ip virtual-reassembly
ip tcp adjust-mss 1452
!
interface Vlan7
ip address 172.16.7.251 255.255.255.0
ip access-group 102 in
ip nat inside
ip virtual-reassembly
ip tcp adjust-mss 1452
shutdown
!
interface Vlan13
ip address 172.16.13.254 255.255.255.0
ip access-group 113 in
ip nat inside
ip virtual-reassembly
ip tcp adjust-mss 1452
!
interface Dialer0
ip address negotiated
no ip redirects
no ip unreachables
no ip proxy-arp
ip mtu 1492
ip nat outside
ip virtual-reassembly
encapsulation ppp
dialer pool 1
dialer-group 1
no cdp enable
ppp authentication chap callin
ppp chap hostname ******
ppp chap password 0 ******
!
router ospf 1
router-id 172.16.8.251
log-adjacency-changes
area 0.0.0.0 authentication message-digest
network 10.0.0.0 0.0.0.255 area 0.0.0.0
network 172.16.0.0 0.15.255.255 area 0.0.0.0
network 192.168.0.0 0.0.255.255 area 0.0.0.0
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 Dialer0 2
ip http server
ip http access-class 23
ip http authentication local
ip http secure-server
ip http timeout-policy idle 60 life 86400 requests 10000
!
!
ip nat log translations syslog
ip nat inside source list 1 interface Dialer0 overload
ip nat inside source static tcp 172.16.8.2 22 interface Dialer0 22
ip nat inside source static tcp 172.16.8.2 443 interface Dialer0 443
ip nat inside source static tcp 172.16.8.2 80 interface Dialer0 80
ip nat inside source static tcp 172.16.8.2 25 interface Dialer0 25
ip nat inside source static tcp 172.16.8.2 465 interface Dialer0 465
ip nat inside source static udp 172.16.8.2 53 interface Dialer0 53
ip nat inside source static udp 127.0.0.1 1 80.68.188.228 1 extendable
[... da porta 2 a porta 1022]
ip nat inside source static udp 127.0.0.1 1023 80.68.188.228 1023 extendable
!
logging 172.16.8.1
access-list 1 remark INSIDE_IF=Vlan1
access-list 1 remark CCP_ACL Category=2
access-list 1 permit 172.16.8.0 0.0.0.255
access-list 1 permit 172.16.7.0 0.0.0.255
access-list 1 permit 172.16.6.0 0.0.0.255
dialer-list 1 protocol ip permit
no cdp run

!
!
!
!
!
control-plane
!
banner exec ^CCC
% Password expiration warning.
banner login ^CCCAuthorized access only!
Disconnect IMMEDIATELY if you are not an authorized user!^C
!
line con 0
login local
no modem enable
line aux 0
line vty 0 4
privilege level 15
login local
transport input telnet ssh
!
scheduler max-task-time 5000
ntp server 172.16.8.3
ntp server 172.16.8.7
end
---

Suggerimenti?

Grazie,
Daniele
Rispondi