一、实验拓扑
二、实验目的
1、熟练掌握ospf的配置
2、熟练掌握RIP的配置
3、熟练掌握静态路由的配置
4、熟练掌握各种路由协议之间的引入
5、熟练掌握telnet和ssh的配置
三、实验配置
R1
//配置telent
username admin password admin@123
enable password admin@123
enable service telnet-server
line vty 0 4
login local
exit//配置互联ip地址
int gi0/2
no sw
ip add 23.1.1.1 255.255.255.0
exit
配置RIP
route rip //进入RIP
version 2 //指定版本为RIPV2
no auto-summary //关闭自动汇总
network 23.1.1.1 //宣告与R2的互联网段
exit
R2
username admin password admin@123
enable password admin@123
enable service telnet-server
line vty 0 4
login local
exit//配置loopback 0 管理地址
int loopback 0
ip add 1.1.1.1 255.255.255.255
exit//配置互联ip地址
int gi0/2
no sw
ip add 23.1.1.2 255.255.255.0int gi0/0
no sw
ip add 172.16.1.1 255.255.255.252
int gi0/1
no sw
ip add 172.16.1.5 255.255.255.252exit
//配置OSPF
route ospf //进入ospf,默认进程为1
router-id 1.1.1.1 //指定router-id为1.1.1.1
network 1.1.1.1 0.0.0.0 area 0 //宣告loopback 0 地址
network 172.16.1.1 0.0.0.3 area 0 //宣告与SW1互联地址
network 172.16.1.5 0.0.0.3 area 0 //宣告与SW2互联地址
network 23.1.1.2 0.0.0.255 area 0 //宣告与R1互联地址
redistribute rip metric-type 1 subnets //重发布RIP路由进入ospf类型为1
exit
route rip
version 2
no auto-summary
network 23.1.1.2
redistribute ospf 1 //重发布ospf进程1进入RIP中
exit
SW1
username admin password admin@123
enable password admin@123
enable service ssh-server
no enable service telnet-server
crypto key generate rsa
line vty 0 4
login local
transport input ssh
exitint loopback 0
ip add 2.2.2.2 255.255.255.255
exitint gi0/2
sw mo tr
sw tr al vl re 1-4094 //拒绝全部vlan通过
sw tr al vl add 10,100 //允许vlan10,100通过vlan range 10,100
exitint gi0/1
no sw
ip add 172.16.1.2 255.255.255.252int vlan 100
ip add 192.168.100.126 255.255.255.192int vlan 10
ip add 192.168.10.62 255.255.255.192exit
route ospf
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 172.16.1.2 0.0.0.3 area 0
network 192.168.10.62 0.0.0.63 area 0
network 192.168.100.126 0.0.0.63 area 0
network 192.168.100.65 0.0.0.63 area 0
redistribute static metric-type 1 subnets //配置重发布静态路由进入ospf中
exitip route 0.0.0.0 0.0.0.0 192.168.100.65
SW2
username admin password admin@123
enable password admin@123
enable service ssh-server
no enable service telnet-server
crypto key generate rsa
line vty 0 4
login local
transport input ssh
exit
int loopback 0
ip add 3.3.3.3 255.255.255.255
exitint gi0/2
sw mo tr
sw tr al vl re 1-4094
sw tr al vl add 20,200vlan range 20,200
exitint gi0/1
no sw
ip ad 172.16.1.6 255.255.255.252int vlan 200
ip add 192.168.200.254 255.255.255.192int vlan 20
ip add 192.168.20.190 255.255.255.192
exit
route ospf
router-id 3.3.3.3
network 3.3.3.3 0.0.0.0 area 0
network 172.16.1.6 0.0.0.3 area 0
network 192.168.20.190 0.0.0.63 area 0
network 192.168.200.254 0.0.0.63 area 0
network 192.168.200.193 0.0.0.63 area 0
redistribute static metric-type 1 subnets
exitip route 0.0.0.0 0.0.0.0 192.168.200.193
SW3
username admin password admin@123
enable password admin@123
enable service telnet-server
line vty 0 4
login local
exit
vlan range 10,100
exitint vlan 100
ip add 192.168.100.65 255.255.255.192
exitint gi0/2
sw mo tr
sw tr al vl re 1-4094
sw tr al vl add 10,100int gi 0/1
sw mo ac //允许vlan10通过
sw ac vl 10exit
ip route 0.0.0.0 0.0.0.0 192.168.100.126
SW4
username admin password admin@123
enable password admin@123
enable service telnet-server
line vty 0 4
login local
exitvlan range 20,200
int vlan 200
ip add 192.168.200.193 255.255.255.192
int gi 0/2
sw mo tr
sw tr al vl re 1-4094
sw tr al vl add 20,200int gi 0/1
sw mo ac
sw ac vl 20exit
ip route 0.0.0.0 0.0.0.0 192.168.200.254