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