返回顶部

思科CNNA中文教程 - 第三章用户访问和权限管理(下)

  3.12 部署Banners

  提问 设置登录时显示的警示性信息

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#banner exec #This is an exec banner #

  Router1(config)#banner login #This is a login banner #

  Router1(config)#banner motd $ This is a motd banner $

  Router1(config)#end

  Router1#

  注释 不用使用welcome之类的字样,下面是一个FBI的路由器登录banner作参考

  Router1(config)#banner login #

  Enter TEXT message.End with the character '#'.

  +-------------------------------------------------------------+

  | WARNING |

  | ------------ |

  | This system is solely for the use of authorized users for official |

  |purposes. You have no expectation of privacy in its use and to |

  | ensure that the system is functioning properly,individuals using |

  |this computer system are subject to having all of their activities |

  |monitored and recorded by system personnel.Use of this system|

  |evidences an express consent to such montoring and agreement that |

  |if such monitoring reveals eidence of possible abuse of criminal |

  |activity,system personnel may provide the results of such |

  |monitoring to appropriate officials. |

  +--------------------------------------------------------------|

  #

  Router1(config)#end

  Router1# 

  3.13 在特定端口禁用Banners显示

  提问 aux口用于modem连接,为了避免出现问题希望关闭banner显示

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line aux 0

  Router1(config-line)#no motd-banner

  Router1(config-line)#no exec-banner

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释

  3.14 禁用Line登录

  提问 禁止在AUX或者Line端口进行设备登录

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line aux 0

  Router1(config-line)#transport input none

  Router1(config-line)#no exec

  Router1(config-line)#exec-timeout 0 1

  Router1(config-line)#no password

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#access-list 98 deny any log

  Router1(config)#line vty 0 4

  Router1(config-line)#transport input none

  Router1(config-line)#exec-timeout 0 1

  Router1(config-line)#no exec

  Router1(config-line)#access-class 98 in

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 无

  3.15 为管理员保留特定的登录端口

  提问 防止所有的登录端口都被占用,为管理员留一个后门

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#access-list 9 permit 172.25.1.1

  Router1(config)#line vty 4

  Router1(config-line)#access-class 9 in

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  或者

  Router1#confgiure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#access-list 9 permit 172.25.1.1

  Router1(config)#line vty 5 7

  Router1(config-line)#rotary 25

  Router1(config-line)#access-class 9 in

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释在使用第二种rotary命令时就相应的改变登录时的端口号码,不是缺省的23,而是3000+rotary的号码25=3025

思科CNNA中文教程 - 第三章用户访问和权限管理(下)

  3.16 限制特定地址的Telnet登录

  提问 只允许特定的机器进行Telnet登录

  回答

  Router1#configure terminal

  Enter configuraion commands,one per line.End with CNTL/Z.

  Router1(config)#access-list 99 permit 172.25.1.0 0.0.0.255

  Router1(config)#access-list 99 deny any log

  Router1(config)#line vty 0 4

  Router1(config-line)#access-class 99 in

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 无

  3.17 对Telnet访问进行日志记录

  提问 记录每次telnet的日志

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#access-list 90 permit any log

  Router1(config)#line vty 0 4

  Router1(config-line)#access-class 90 in

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 需要注意的是不管登录成功还是失败,在日志中都是显示的permitted:

  %SEC-6-IPACCESSLOGS:list 90 permitted 172.25.1.1 1 packet

  3.18 设置发起Telnet的源地址

  提问 有时对端设备有安全设置只允许特定的地址发起telnet请求

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#ip telnet source-interface loopback0

  Router1(config)#end

  Router1#

  或者

  Router1#telnet 172.25.1.5 /source-interface loopback0

  注释 缺省情况路由器会使用到目的地所使用的端口来做Telnet的源地址

  3.19 自动登录

  注释 使用脚本略去,其实用SecueCRT很容易设定

  3.20 使用SSH登录

  提问 启用SSH这种加密的登录方式

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#hostname Router1

  Router1(config)#ip domain-name neoshi.net

  Router1(config)#crypto key generate rsa

  The name for the keys will be:Router1.oreilly.com

  Choose the size of the key modulus in the greator than 512 may take

  General Purpose Keys.Choosing a key modulus greater than 512 nay take

  a few minutes.

  How many bits in the modulus[512]:1024

  Generating RSA keys...

  [OK]

  Router1(config)#

  Jun 27 15:04:15:%SSH-5-ENABLED:SSH 1.5 has been enabled

  Router1(config)#ip ssh time-out 120

  Router1(config)#ip ssh quthentication-retries 4

  Router1(config)#end

  Router1#

  注释 从IOS12.3(4)T开始支持SSH v2,之前只支持v1,首先要确认你的IOS版本,然后确认支持安全特性3DES,才能开启SSH特性

  <!--[if !supportLists]-->       <!--[endif]-->
   
      3.21. 改变IOS命令的特权等级

  提问 修改特定IOS命令的特权等级

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#privilege exec level 1 show startup-config

  Router1(config)#end

  Router1#

  注释 缺省情况路由器支持16种特权等级,命令一般归属于0,1和15三种特权等级,在特权等级0 下面只支持disable,enable,exit,help,和logout命令,1下面不能对配置进行修改,15就是enable的特权等级

  3.22 基于用户的赋予不同的特权等级

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#aaa new-model

  Router1(config)aaa authentication login default local

  Router1(config)#aaa authorization exec default local

  Router1(config)#username neoshi privilege 10 password ioscookbook

  Router1(config)#privilege exec level 10 show ip route

  Router1(config)#privilege exec level 1 show ip

  Router1(config)#privilege exec level 1 show

  Router1(config)#end

  Router1#

  注释 通常的0,1和15三种等级弹性不足,可以定义更多的等级给不同的用户

  <!--[if !supportLists]-->3.22 <!--[endif]-->基于端口的特权等级

  提问 根据登录的不同端口自动赋予特定的特权等级

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line aux 0

  Router1(config-line)#privilege level 5

  Router1(config-line)#exit

  Router1(config)#privilege exec level 5 show ip route

  Router1(config)#privilege exec level 1 show ip

  Router1(config)#privilege exec level 1 show

  Router1(config)#end

  Router1#



400-0806-056