(config)# username 名字 password 密码
(config)# line vty 0 4
(config)# login local
1.3IP配置
电脑
IP
pc0
192.168.1.1
1.4路由器设置
Router(config)#int f0/0
Router(config-if)#ip add 192.168.1.254 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up
Router(config-if)#username taiyuan pa
Router(config-if)#username taiyuan password 111
Router(config)#line vty 0 4
Router(config-line)#login local
Router(config-line)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#
1.5连接效果
1.6注意事项
路由器不设密码的话远程不可登陆
二.手动添加路由表
2.1拓扑结构
2.2使用命令
静态路由协议
(config)# IP route 目标网络 子网掩码 下一跳地址# show ip route 查看路由表
2.3IP,网段配置
设备
IP
掩码
网关
DNS
PC0
192.168.1.1
255.255.255.0
192.168.1.254
192.168.4.1
Server0
192.1684.1
255.255.255.0
192.168.4.254
192.168.4.1
Server0
192.1684.2
255.255.255.0
192.168.4.254
192.168.4.1
路由器
Router
F0/0
F0/1
Router0
192.168.1.254
192.168.2.1
Router1
192.168.2.2
192.168.3.1
Router2
192.168.3.2
192.168.4.25
2.4实验思路
先设置网
分配IP
给路由器设置网关
手动添加路由表 (config)#ip route 目的网络 掩码 下一跳地址
查询路由表 # show ip route
2.5路由器配置
Router0
Router(config)#int f0/0
Router(config-if)#ip add192.168.1.254255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up
Router(config-if)#int f0/1
Router(config-if)#ip add192.168.2.1255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip route 192.168.3.0255.255.255.252192.168.2.2
Router(config)#ip route 192.168.4.0255.255.255.252192.168.2.2
Router(config)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
///*当我们把所有的路由表全部*/
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype1, N2 - OSPF NSSA externaltype2
E1 - OSPF externaltype1, E2 - OSPF externaltype2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort isnotset
C 192.168.1.0/24is directly connected, FastEthernet0/0
Router#
Router#
Router1
Router(config)#int f0/0
Router(config-if)#ip add 192.168.2.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up
Router(config-if)#int f0/1
Router(config-if)#ip add 192.168.3.1 255.255.225.252
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
Router(config)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#
Router2
Router(config)#int f0/0
Router(config-if)#ip add 192.168.3.2 255.255.255.252
Router(config-if)#no sh
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up
Router(config-if)#int f0/1
Router(config-if)#ip add 192.168.4.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/1, changed state to up
Router(config-if)#
Router(config-if)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
Router(config)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#
Router#wr
Building configuration...
[OK]
2.6添加情况
///*当路由表全部添加完毕,则显示下面*/
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype1, N2 - OSPF NSSA externaltype2
E1 - OSPF externaltype1, E2 - OSPF externaltype2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort isnotset
S 192.168.1.0/24 [1/0] via 192.168.3.1
S 192.168.2.0/24 [1/0] via 192.168.3.1192.168.3.0/30is subnetted, 1 subnets
C 192.168.3.0is directly connected, FastEthernet0/0
C 192.168.4.0/24is directly connected, FastEthernet0/1
Router#