动态路由协议RIP和OSPF的综合应用 路由重分布技术 DHCP RIP OSPF 交换机端口聚合技术 Cisco

Lani ·
更新时间:2024-11-15
· 742 次阅读

网络互连要求: 规划和设计各路由接口的IP地址; 除了路由器R4的G0/1、G0/2两个接口外,在其它路由器的所有接口上使用OSPF动态路由协议进行子网互连,进程号假设都为5021; 在路由器R4的G0/1、G0/2两个接口,及三层交换机的所有网段上启用RIP version2动态路由协议,且不要自动汇总; 在S1 、S2的接口F0/2、F0/3上,设置交换机端口聚合,聚合后的接口port1设置为trunk模式; 在S1 、S2上创建VLAN 2和VLAN 3,并在S1上设置这两个VLAN的地址分别为192.168.5.254/24、192.168.6.254/24; 在S2上设置这两个VLAN的地址分别为192.168.5.253/24、192.168.6.253/24; 在S1上为VLAN 2和VLAN 3的计算机创建DHCP服务,实现IP地址自动分配服务; 在路由器R4上使用路由重分布技术,使RIP和OSPF子网互相学习到,到彼此子网的的路由信息; 网络拓扑图:

代码: R1: En Conf t Host r1 No ip domain-lookup Int g0/0 Ip address 192.168.3.1 255.255.255.252 No shut Int g0/1 Ip address 192.168.1.254 255.255.255.0 No shut Int g0/2 Ip address 192.168.3.13 255.255.255.252 No shut Int loopback 0 Ip address 1.1.1.1 255.255.255.255 No shut Exit Router ospf 5021 Network 192.168.1.0 0.0.0.255 area 0 Network 192.168.3.0 0.0.0.3 area 0 Network 192.168.3.12 0.0.0.3 area 0 R2: En Conf t Host r2 No ip domain-lookup Int g0/0 Ip address 192.168.3.2 255.255.255.252 No shut Int s0/3/0 Clock rate 2000000 Ip address 192.168.3.5 255.255.255.252 No shut Int loopback 0 Ip address 2.2.2.2 255.255.255.255 No shut Exit Router ospf 5021 Network 192.168.3.0 0.0.0.3 area 0 Network 192.168.3.4 0.0.0.3 area 0 R3: En Conf t Host r3 No ip domain-lookup Int g0/1 Ip address 192.168.2.254 255.255.255.0 No shut Int s0/3/0 Ip address 192.168.3.6 255.255.255.252 No shut Int s0/3/1 Ip address 192.168.3.10 255.255.255.252 No shut Int loopback 0 Ip address 3.3.3.3 255.255.255.255 No shut Exit Router ospf 5021 Network 192.168.2.0 0.0.0.255 area 0 Network 192.168.3.4 0.0.0.3 area 0 Network 192.168.3.8 0.0.0.3 area 0 R4: En Conf t Host r4 No ip domain-lookup Int g0/0 Ip address 192.168.3.14 255.255.255.252 No shut Int g0/1 Ip address 192.168.4.2 255.255.255.252 No shut Int g0/2 Ip address 192.168.4.6 255.255.255.252 No shut Int s0/3/1 Ip address 192.168.3.9 255.255.255.252 No shut Int loopback 0 Ip address 4.4.4.4 255.255.255.255 No shut Exit Router ospf 5021 Network 192.168.3.12 0.0.0.3 area 0 Network 192.168.3.8 0.0.0.3 area 0 Redistribute rip metric 3 subnets !subnets重分布子网,如果省略,则不重分布子网 Exit Router rip Version 2 Network 192.168.4.0 Network 192.168.4.4 No auto-summary Redistribute ospf 5021 metric 3 !rip路由协议重分布缺省的开销值是无穷大,结果就是重分布的路由选择协议所学习到的 网络条目并不会分布到rip里面去 Exit S1: En Conf t Host s1 No ip domain-lookup Int range f0/2-3 Channel-group 1 mode desirable Switchport mode access Switchport mode trunk Exit Vlan 5 Exit Vlan 6 Exit Int vlan 5 Ip address 192.168.5.254 255.255.255.0 Int vlan 6 Ip address 192.168.6.254 255.255.255.0 Int f0/1 No switchport Ip address 192.168.4.1 255.255.255.252 No shut Int f0/4 Switchport access vlan 5 Int f0/5 Switchport access vlan 6 Exit Ip routing Router rip Version 2 Network 192.168.4.0 Network 192.168.5.0 Network 192.168.6.0 No auto-summary Exit service dhcp !启动dhcp服务 ip dhcp excluded-address 192.168.5.253 192.168.5.254 !排除不拿来分配的地址192.168.5.253 到192.168.5.254的所有 ip dhcp pool vlan5 !建立一个地址池,名字由字母加数字构成 network 192.168.5.0 255.255.255.0 default-router 192.168.5.254 !指定客户机的网关地址 dns-server 8.8.8.8 !给定客户机dns服务器地址,8.8.8.8是google的 exit ip dhcp excluded-address 192.168.6.253 192.168.6.254 ip dhcp pool vlan6 network 192.168.6.0 255.255.255.0 default-router 192.168.6.254 dns-server 114.114.114.114 ! 114.114.114.114这个是中国电信的 exit S2: En Conf t Host s2 No ip domain-lookup Int range f0/2-3 Channel-group 1 mode desirable Switchport mode access Switchport mode trunk Exit Vlan 5 Exit Vlan 6 Exit Int vlan 5 Ip address 192.168.5.253 255.255.255.0 Int vlan 6 Ip address 192.168.6.253 255.255.255.0 Int f0/1 No switchport Ip address 192.168.4.5 255.255.255.252 No shut Exit Ip routing Router rip Version 2 Network 192.168.4.4 Network 192.168.5.0 Network 192.168.6.0 No auto-summary Exit DHCP配置结果:

路由器,三层交换机的路由表:

R1:

R2:

R3:

R4:

S1:

S2:

主机可达性测试:

PC1:

PC2:


作者:aiworenyanzhousuanfa



端口聚合 ospf rip 分布 动态路由 交换机 dhcp 路由 动态

需要 登录 后方可回复, 如果你还没有账号请 注册新账号