2011ǯ05

ƥ:

IOSǤΥ󥿡եѤNTP롢Ȥ꤬ǽǤ

R1ǤF0/0R2(12.12.12.2)³Ƥޤ

R1(config-if)#do sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up
FastEthernet0/1            192.168.0.100   YES manual up                    up

R1Ǥntp serverޥɤˤNTP饤ȤȤƲƯǤ

R1#show ntp associations

      address         ref clock     st  when  poll reach  delay  offset    disp
*~2.2.2.2                2.2.2.2     2    20    64  377    16.1    6.34    14.5
* master (synced), # master (unsynced), + selected, - candidate, ~ configured

ntp broadcastޥɤѤF0/0NTPͭˤޤ

R1(config)#int f0/0
R1(config-if)#ntp ?
  broadcast  Configure NTP broadcast service
  disable    Disable NTP
  multicast  Configure NTP multicast service

R1(config-if)#ntp broadcast ?
  client       Listen to NTP broadcasts
  destination  Configure broadcast destination address
  key          Configure broadcast authentication key
  version      Configure NTP version
  <cr>

R1(config-if)#ntp broadcast

R2F0/0ntp broadcastޥɤѤޤ

R2(config-if)#int f0/0
R2(config-if)#ntp broadcast client

塢Ф餯ƤǧƱλƤ뤳ȤǧǤޤ

R2#show ntp associations

      address         ref clock     st  when  poll reach  delay  offset    disp
* 12.12.12.1            2.2.2.2      3    35    64  376    10.7   19.48    13.3
* master (synced), # master (unsynced), + selected, - candidate, ~ configured

R2#show ntp associations detail
12.12.12.1 dynamic, our_master, sane, valid, stratum 3
ref ID 2.2.2.2, time D1857C68.39BD36B2 (09:38:00.225 JST Tue May 24 2011)
our mode bdcast client, peer mode bdcast, our poll intvl 64, peer poll intvl 64
root delay 8.56 msec, root disp 58.88, reach 376, sync dist 81.833
delay 10.68 msec, offset 19.4788 msec, dispersion 13.34
precision 2**18, version 3
org time D1857C80.30D43D1E (09:38:24.190 JST Tue May 24 2011)
rcv time D1857C80.2BD7AC79 (09:38:24.171 JST Tue May 24 2011)
xmt time D18578C2.B9D9ABD2 (09:22:26.725 JST Tue May 24 2011)
filtdelay =    10.68   10.68   10.68   10.68   10.68   10.68   10.68   10.68
filtoffset =   19.48   14.56  -10.12   31.54   19.16    3.90  -10.70   18.66
filterror =     0.99    1.97    2.94    3.92    4.90    5.87    6.85    7.83

R2#show clock
09:40:00.176 JST Tue May 24 2011

ƥ:

ϥե졼ѹΤꤷޤԤȤˤ꤬ĹԤ줿ξܺ٤¸뤳ȤǽǤ

R1(config)#archive
R1(config-archive)#log config
R1(config-archive-log-cfg)#logging enable

塢ǧޤͤhidekeysͭˤʤäƤ뤳Ȥʬޤ

R1(config-archive-log-cfg)#do sh run | b archive
archive
log config
  logging enable
  hidekeys
!
ά

s1/0no shutƳǧޤ

R1(config-archive-log-cfg)#int s1/0
R1(config-if)#no sh

show archiveޥɤѤ뤳ȤǡѹǧǤޤ

R1#show archive log config all
idx   sess           user@line      Logged command
    1     1        console@console  |  logging enable
    2     1        console@console  |do sh run | b archive
    3     1        console@console  | interface Serial1/0
    4     1        console@console  | no shutdown

telnetR1˥桼ciscoǥ󤷡s1/0shutνϤǤ

   15     0          cisco@vty0     |!exec: enable
   16     6          cisco@vty0     |interface Serial1/0
   17     6          cisco@vty0     | shutdown

ޤǤɽǤɽޤ󡣽Ϥ뤳Ȥɽ褦ˤʤޤ

R1(config)#archive
R1(config-archive)#log config
R1(config-archive-log-cfg)#notify syslog

May 16 06:08:04.651: %PARSER-5-CFGLOG_LOGGEDCMD: User:console  logged command:notify syslog
May 16 06:08:36.403: %PARSER-5-CFGLOG_LOGGEDCMD: User:console  logged command:interface Serial1/0
May 16 06:08:38.483: %PARSER-5-CFGLOG_LOGGEDCMD: User:console  logged command:no shutdown

ͤꤵƤhidekeysϥѥɾ򱣤ɽޤ

R1(config)#username apple secret apple

May 16 07:10:25.655: %PARSER-5-CFGLOG_LOGGEDCMD: User:cisco  logged command:username apple secret *****

hidekeys򤢤̵ˤȡѥɤΤޤɽ뤳Ȥʬޤ

R1(config-archive-log-cfg)#no hidekeys
R1(config)#username lemon secret lemon

May 16 07:11:21.391: %PARSER-5-CFGLOG_LOGGEDCMD: User:console  logged command:username lemon secret lemon

loggingޥɤǥФꤹ뤳Ȥǡ¸뤳ȤǽǤLinux(Red Hat)ä硢ͤǤ/var/log/messages¸뤳Ȥʬޤ

R1(config)#logging 192.168.0.180
# tail -f /var/log/messages
May 16 21:59:36 192.168.0.100 61: May 16 07:10:59.175: %PARSER-5-CFGLOG_LOGGEDCMD: User:cisco  logged command:archive
May 16 21:59:41 192.168.0.100 62: May 16 07:11:04.711: %PARSER-5-CFGLOG_LOGGEDCMD: User:cisco  logged command:log config
May 16 21:59:44 192.168.0.100 63: May 16 07:11:06.899: %PARSER-5-CFGLOG_LOGGEDCMD: User:cisco  logged command:no hidekeys
May 16 21:59:58 192.168.0.100 64: May 16 07:11:21.391: %PARSER-5-CFGLOG_LOGGEDCMD: User:console  logged command:username lemon secret lemon

ƥ:

IOSǤΥLinuxǵϿԤޤR1F0/1(192.168.0.100)LAN³ƤޤLinuxФIPɥ쥹192.168.0.180Ǥ

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up
FastEthernet0/1            192.168.0.100   YES manual up                    up
Loopback0                  17.17.1.1       YES NVRAM  up                    up

R1#ping 192.168.0.180

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

LinuxdzΥˤsyslogdư-rץɬפǤ/etc/sysconfig/syslogɲäơsyslogdƵưޤ

# grep 'SYSLOGD_OPTIONS' /etc/sysconfig/syslog
SYSLOGD_OPTIONS="-m 0 -r"
# /etc/rc.d/init.d/syslog restart

ޤIOSˤloggingޥɤsyslogФꤷޤ

R1(config)#logging 192.168.0.180 (logging host 192.168.0.180 )

γǧˤshow loggingѤޤͤǤϰŪѤ롢UPD ݡ514ꤵ뤳Ȥʬޤ

R1(config)#do sh loggi | i Logging to
        Logging to 192.168.0.180  (udp port 514,  audit disabled,

F0/0shutLinux˥Ϥǧޤ

R1(config)#int f0/0
R1(config-if)#sh

 

# tail -f /var/log/messages
May 10 20:08:01 192.168.0.100 56: May 10 07:37:20.291: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.12.12.2 (FastEthernet0/0) is down: interface down
May 10 20:08:03 192.168.0.100 57: May 10 07:37:22.259: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
May 10 20:08:03 192.168.0.100 58: May 10 07:37:23.259: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down

¸Ƥ뤳ȤʬޤƤΥ롼ǹԤСǤ뤳Ȥʬޤ

ߤΥ򸫤ȡF0/1(192.168.0.100)ˤʤäƤޤѹˤlogging source-interfaceޥɤѤޤǤLo0ꤷƤߤޤ

R1(config)#logging source-interface loopback 0
R1(config)#int f0/0
R1(config-if)#no sh

ѹ줿Ȥʬޤ

May 10 20:11:43 17.17.1.1 59: May 10 07:40:57.567: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

/etc/hosts˥ۥ̾ϿȤȽ̤䤹ʤޤ

# grep r1 /etc/hosts
17.17.1.1       r1.example.com r1

May 10 20:14:01 r1.example.com 63: May 10 07:43:20.455: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.12.12.2 (FastEthernet0/0) is down: interface down

IOSΥ̤¸ϥեƥѤޤǤlocal5ꤷޤ

R1(config)#logging facility local5

Linuxǥեƥlocal5Ωե/var/log/ios¸Ǥ/var/log/messageslocal5.noneɲä뤳ȤǥŤݴɤ뤳ȤɤǤޤ

# grep 'local5' /etc/syslog.conf
*.info;mail.none;authpriv.none;cron.none;local5.none            /var/log/messages
local5.*                                                /var/log/ios

ʹߡѤΥե(/var/log/ios)ˤΤ¸뤳Ȥʬޤ

# tail -f /var/log/ios /var/log/messages

==> /var/log/ios <==
May 10 20:28:30 r1.example.com 81: May 10 07:57:49.123: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.12.12.2 (FastEthernet0/0) is down: interface down

ƥ:

IOSǤFTPѤǧޤR1F0/1IPɥ쥹192.168.0.100ǡFTPФ192.168.0.180Ǥ

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up
FastEthernet0/1            192.168.0.100   YES manual up                    up

ޤꤷƤʤ֤ѤƤߤޤR1startup-configFTPФ˥ԡǤԤƤޤ

R1#copy startup-config ftp:
Address or name of remote host []? 192.168.0.180
Destination filename [r1-confg]?
Writing r1-confg
%Error opening ftp://192.168.0.180/r1-confg (Permission denied)

FTPФǤΥ(/var/log/vsftpd.log)ϤΤ褦ˤʤޤ桼̾ftpѥɤrouter@cisco.coȤʤäƤޤ桼̾ftpޤanonymousǤϥΥ˥ޥ(ƿ̾)FTPȤï⤬ǽǤλѥɤϥåʤΤDzƤפǤΥ˥ޥFTPǤϥƥ塢ɤΤߤĤ쥢åץɤϵĤʤΤŪǤͳꡢԡϼԤޤ

Wed May  4 16:15:14 2011 [pid 18496] CONNECT: Client "192.168.0.100"
Wed May  4 16:15:14 2011 [pid 18495] [ftp] OK LOGIN: Client "192.168.0.100", anon password "router@cisco.co"

٤ϵդFTPоΥե(orange)flash˥ɤƤߤޤʤѽ뤳Ȥʬޤ

R1#copy ftp: flash:
Address or name of remote host []?
192.168.0.180
Source filename []? orange
Destination filename [orange]?
Accessing ftp://192.168.0.180/orange...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading orange
[OK - 12/4096 bytes]

Verifying checksum...  OK (0x3E66)
12 bytes copied in 0.144 secs (83 bytes/sec)

R1#more flash:orange
Hello! IOS.

桼̾ꤷFTPѤˤͽ桼̾ȥѥɤꤷޤFTPФˤϥ桼̾ciscoѥciscoǤϿƤޤ

R1(config)#ip ftp username cisco
R1(config)#ip ftp password cisco

Ǻǽ˻ƤߤR1startup-configFTPФ˺٥ԡƤߤޤ

R1#copy running-config ftp:
Address or name of remote host []? 192.168.0.180
Destination filename [r1-confg]?
Writing r1-confg !
1347 bytes copied in 4.276 secs (315 bytes/sec)

¹ԤޤFTPФΥߤȥ桼ciscoǥ󤷤Ƥ뤳Ȥʬޤ

Wed May  4 16:33:00 2011 [pid 18573] CONNECT: Client "192.168.0.100"
Wed May  4 16:33:00 2011 [pid 18572] [cisco] OK LOGIN: Client "192.168.0.100"
Wed May  4 16:33:00 2011 [pid 18574] [cisco] OK UPLOAD: Client "192.168.0.100", "/home/cisco/r1-confg", 1347 bytes, 68.91Kbyte/sec

ǰΰ٤FTPФˤե򳫤Ƥߤޤ

# head -5 /home/cisco/r1-confg

!
! Last configuration change at 15:14:03 JST Wed May 4 2011
!
version 12.4

Τ褦FTPФꤵƤСեեΥХååפʤɤñ˼뤳ȤǽǤ

ΥڡΥȥåץ

Ф