CCNA第四天(路由器远程连接,手动添加路由表)

来源:互联网 发布:世宗大王级驱逐舰知乎 编辑:程序博客网 时间:2024/06/10 19:24

一.路由器远程连接

1.1拓扑结构

这里写图片描述

1.2使用命令

(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/0Router(config-if)#ip add 192.168.1.254 255.255.255.0Router(config-if)#no shRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#username taiyuan paRouter(config-if)#username taiyuan password 111Router(config)#line vty 0 4Router(config-line)#login localRouter(config-line)#^ZRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#wrBuilding 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实验思路

  1. 先设置网
  2. 分配IP
  3. 给路由器设置网关
  4. 手动添加路由表
    (config)#ip route 目的网络 掩码 下一跳地址
  5. 查询路由表
    # show ip route

2.5路由器配置

Router0

Router(config)#int f0/0Router(config-if)#ip add 192.168.1.254 255.255.255.0Router(config-if)#no shutdown Router(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int f0/1Router(config-if)#ip add 192.168.2.1 255.255.255.252Router(config-if)#no shutdown Router(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to upRouter(config-if)#ip route 192.168.3.0 255.255.255.252 192.168.2.2Router(config)#ip route 192.168.4.0 255.255.255.252 192.168.2.2Router(config)#^ZRouter#%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 external type 1, N2 - OSPF NSSA external type 2       E1 - OSPF external type 1, E2 - OSPF external type 2, 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 routeGateway of last resort is not setC    192.168.1.0/24 is directly connected, FastEthernet0/0Router#Router#

Router1

Router(config)#int f0/0Router(config-if)#ip add 192.168.2.2 255.255.255.252Router(config-if)#no shutdown Router(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int f0/1Router(config-if)#ip add 192.168.3.1 255.255.225.252Router(config-if)#no shRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to upRouter(config-if)#ip route 192.168.1.0 255.255.255.0 192.168.2.1Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2Router(config)#^ZRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#wrBuilding configuration...[OK]Router#

Router2

Router(config)#int f0/0Router(config-if)#ip add 192.168.3.2 255.255.255.252Router(config-if)#no shRouter(config-if)#no shutdown Router(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int f0/1Router(config-if)#ip add 192.168.4.254 255.255.255.0Router(config-if)#no shutdown Router(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#Router(config-if)#ip route 192.168.1.0 255.255.255.0 192.168.3.1Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1Router(config)#^ZRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#Router#wrBuilding 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 external type 1, N2 - OSPF NSSA external type 2       E1 - OSPF external type 1, E2 - OSPF external type 2, 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 routeGateway of last resort is not setS    192.168.1.0/24 [1/0] via 192.168.3.1S    192.168.2.0/24 [1/0] via 192.168.3.1     192.168.3.0/30 is subnetted, 1 subnetsC       192.168.3.0 is directly connected, FastEthernet0/0C    192.168.4.0/24 is directly connected, FastEthernet0/1Router#

2.7连接情况

这里写图片描述

原创粉丝点击