1、路由器的高级配置
路由器的主要功能是将数据包转发到目的网络中,为了实现这个目标,需要查找路由表,那么路由器是如何构造路由表的:
1.直连路由
2.静态路由
3.动太路由
可以通过show ip route命令查看路由表。
R1#show ip route
C 192.168.1.0/24 is directly connected,FastEthernet0/0
C 192.168.2.0/24 is directly connected,FastEthernet0/1
添加静态路由
R1#
R1#conf t
R1(config)# ip route 192.
2、168.3.0 255.255.255.0 192.168.2.2
R1# show ip route
C 192.168.1.0/24 is directly connected,FastEthernet0/0
C 192.168.2.0/24 is directly connected,FastEthernet0/1
S 192.168.3.0[1/0] via 192.168.2.2
R1#
同理可以配置R2路由器,这样网络就可以互连互通了。
动态路由主要是通过动态路由协议来实现的,常用的有RIP、OSPF等协议。
RIP协议配置命令
R1#config t
3、
R1(config)# router rip
R1(config-router)# network 192.168.1.0
R1(config-router)# network 192.168.2.0
同理配置R2
R2#config t
R2(config)# router rip
R2(config-router)# network 192.168.2.0
R2(config-router)# network 192.168.3.0
这样网络就可以互连互通了。
OSPF协议配置命令
R1(config)# router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.2.0 0.0.0.255 area 0
同理配置R2
R2(config)# router ospf 1
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#network 192.168.3.0 0.0.0.255 area 0
这样网络就可以互连互通了。
附图如下: