综合实验
1、本实验拓扑如上图; 2、根据拓扑要求为每个设备配置IP地址,保证所有配置的接口状态为UP; 3、配置设备的远程登录和密码保护。配置图中的2台交换机、4台路由器,使6台设备均支持远程登录和配置,配置中出现的所有密码均使用cisco,并且不能在配置文件中明文显示; 4、配置VTP协议,在SW1为VTP Server ,SW2为VTP Client ; 5、vlan 配置。在SW1上配置VLAN ,保证SW2可以使用VTP协议从SW1上同步VLAN配置信息,配置4台PC到对应的VLAN,配置路由器R1的子接口,使其支持vlan间路由; 6、配置STP协议,配置生成树协议,使SW1为跟交换机; 7、配置DHCP。在路由器R1上配置DHCP,使4台PC都可以获取到正确的IP地址、网关和DNS,DNS服务器的地址是218.1.1.2; 8、配置路由器协议,配置R1,使其可以访问Internet,配置R2、R3和R4运行OSPF路由协议,配置完成后,4台路由器之间互相都可以访问; 9、配置PPP协议,路由器R1与R2之间封装的协议是PPP,使用CHAP验证,密码仍然是cisco; 10、配置NAT,在路由器R1上配置动态PAT,使4台PC都可以通过R1访问Internet。在路由器R1上配置静态PAT,是Internet可以通过路由器R1的TCP 2323端口Telnet登录到SW1; 11、配置ACL,配置路由器R1,拒绝vlan 2的主机访问Web 服务器的www 服务,其他服务不受影响。
配置代码:1、设备基本配置R1:enconf tno ip domain lookuphostname R1int s0/0/0ip add 12.1.1.1 255.255.255.0clock rate 56000no shutint fa0/0no shut
R2:
enconf tno ip domain lookuphostname R2int s0/0/0ip add 12.1.1.2 255.255.255.0clock rate 56000no shutint fa0/0ip add 24.1.1.2 255.255.255.0no shutint fa0/1ip add 23.1.1.2 255.255.255.0no shut
R3:
enconf tno ip domain lookuphostname R3int s0/0/0ip add 34.1.1.3 255.255.255.0clock rate 56000no shutint fa0/1ip add 23.1.1.3 255.255.255.0no shut
R4:
enconf tno ip domain lookuphostname R4int s0/0/0ip add 34.1.1.4 255.255.255.0clock rate 56000no shutint fa0/0ip add 23.1.1.4 255.255.255.0no shutint fa0/1ip add 218.1.1.1 255.255.255.0no shut
SW1:
enconf tno ip domain lookuphostname SW1int vlan 1ip add 192.168.1.2 255.255.255.0no shutexitip default-gateway 192.168.1.1
SW2:
enconf tno ip domain lookuphostname SW2int vlan 1ip add 192.168.1.3 255.255.255.0no shutexitip default-gateway 192.168.1.1
2、配置设备的远程登录和密码保护
enconf tline vty 0 4password ciscologinexitenable secret ciscoservice password-encryption
由于配置都一样,故省略。
3、配置VTP协议
SW1:
vlan databasevtp domain CYSDvlan 2 name gouzhongxingvlan 3 name lixiaomengexitconf tint fa0/23switchport mode trunkexitint fa0/24switchport mode trunkexitint fa0/2switchport mode accessswitchport access vlan 2int fa0/3switchport mode accessswitchport access vlan 3
SW2:
vlan databasevtp domain CYSDvtp clientexitconf tint fa0/23switchport mode trunkexitint fa0/24switchport mode trunkexitint fa0/1switchport mode accessswitchport access vlan 2int fa0/2switchport mode accessswitchport access vlan 3
4、配置vlan间路由
SW1:
enconf tint fa0/1switchport mode trunk
R1:
enconf tint fa0/0int fa0/0.1encapsulation dot1Q 1ip add 192.168.1.1 255.255.255.0no shutint fa0/0.2encapsulation dot1Q 2ip add 192.168.2.254 255.255.255.0no shutint fa0/0.3encapsulation dot1Q 3ip add 192.168.3.254 255.255.255.0no shut
5、配置STP协议
spanning-tree vlan 1,2,3 priority 4096
6、配置DHCP
R:
en conf tip dhcp excluded-address 192.168.2.254ip dhcp pool vlan2network 192.168.2.0 255.255.255.0default-router 192.168.2.254dns-server 218.1.1.2exitip dhcp excluded-address 192.168.3.254ip dhcp pool vlan3network 192.168.3.0 255.255.255.0default-router 192.168.3.254dns-server 218.1.1.2exit
7、配置路由协议
R1:
ip route 0.0.0.0 0.0.0.0 12.1.1.2
R2:
conf trouter ospf 1network 24.1.1.0 0.0.0.255 area 0network 23.1.1.0 0.0.0.255 area 0network 12.1.1.0 0.0.0.255 area 0
R3:
conf trouter ospf 1network 34.1.1.0 0.0.0.255 area 0network 23.1.1.0 0.0.0.255 area 0
conf trouter ospf 1network 24.1.1.0 0.0.0.255 area 0network 34.1.1.0 0.0.0.255 area 0network 218.1.1.0 0.0.0.255 area 0
8、配置PPP协议
R1:
username R1 password cisco int s0/0/0encapsulation pppppp authentication chap
R2:
username R2 password cisco int s0/0/0encapsulation pppppp authentication chap
9、配置NAT
conf tint fa0/0.2ip nat inside int fa0/0.3ip nat inside int s0/0/0ip nat outsideexitaccess-list 1 permit 192.168.2.0 0.0.0.255access-list 1 permit 192.168.3.0 0.0.0.255ip nat inside source list 1 int s0/0/0 overload
在路由器R1上配置静态PAT,使Internet可以通过路由器R1的TCP 2323端口Telnet登录到SW1
R1:
conf tint fa0/0.1ip nat insideexitip nat inside source static tcp 192.168.1.2 23 12.1.1.1 2323access-list 1 permit 192.168.1.0 0.0.0.255
配置ACL 。配置路由器R1,拒绝vlan 2 的主机访问Web 服务器的WWW服务,其他服务不受影响
R1:
access-list 100 deny tcp 192.168.2.0 0.0.0.255 host 218.1.1.2 eq 80access-list 100 permit ip any anyint fa0/0.2ip access-group 100 in
|