Router>en //进入特权模式
Router#conf t //进入全局配置模式
Router(config)#hostname xiaowu  //修改路由器的名字为xiaowu
xiaowu(config)#enable secret 51cto //设置特权密码为51cto
xiaowu(config)#line vty 0 4 //进入line模式,设置vty接口
xiaowu(config-line)#password xiaowu //设置vtp密码为xiaowu
xiaowu(config-line)#login //本地验证
xiaowu(config-line)#end  //返回特权模式
xiaowu#exit  //退出
xiaowu con0 is now available
Press RETURN to get started.
*Jul  3 19:16:52.587: %SYS-5-CONFIG_I: Configured from console by console
xiaowu>en //进入特权模式
Password:  //因为我们之前设置了特权密码,所以,这里在进入特权模式的时候要输入密码
xiaowu#conf t //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
xiaowu(config)#int f0/0  //设置f0/0口,这个口是与计算机桥接的那个口
xiaowu(config-if)#ip address 192.168.1.30 255.255.255.0  //配置f0/0的IP地址
xiaowu(config-if)#no shut //启用端口(路由器的默认情况端口都是关闭的,配置后一定要启用)
*Jul  3 19:17:38.663: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Jul  3 19:17:38.663: %ENTITY_ALARM-6-INFO: CLEAR INFO Fa0/0 Physical Port Administrative State Down
*Jul  3 19:17:39.663: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
xiaowu(config)#ip domain-name 51cto.com  //设置一个域
xiaowu(config)#crypto key generate rsa general-keys modulus 1024 //生成一个基于rsa算法的1024位强度的密码
The name for the keys will be: xiaowu.51cto.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
xiaowu(config)#
*Jul  3 19:18:36.519: %SSH-5-ENABLED: SSH 1.99 has been enabled
xiaowu(config)#
xiaowu(config)#ip ssh time 120  //设置ssh超时时间
xiaowu(config)#ip ssh authentication ?      
  <0-5>  Number of authentication retries
xiaowu(config)#ip ssh authentication 4  //设置一个认证强度
xiaowu(config)#line vty 0 4  //设置vty接口
xiaowu(config-line)#transport input ssh  //只允许ssh登录
xiaowu(config-line)#login  //本地验证
xiaowu(config-line)#exit  //退出
xiaowu(config)#aaa new-model   //启用3a认证
xiaowu(config)#aaa authentication login default local  //本地认证
xiaowu(config)#username xiaowu password 51cto  //添加用户名密码(用于稍后的ssh登录)