综合实验 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

拓扑图

各接口划分的IP地址

R1

S 0/3/0:10.1.1.1/24 F0/0.1:192.168.1.1/24 F0/0.2:192.168.2.1/24  F0/0.3:192.168.3.1/24

R2

S 0/3/0:10.1.1.2/24     F0/0:20.1.1.1/24     F0/1:30.1.1.1/24

R3

S0/0:40.1.1.1/24        F 0/0:20.1.1.2/24      F0/1:82.1.1.1/24           远程pc:82.1.1.10/24

R4

S0/0:40.1.1.2/24       F0/0:30.1.1.2/24      F0/1:92.1.1.1/24     DNS服务器IP:92.1.1.10/24

Swit1(vtp server)

VLAN1:192.168.1.2/24      WEB服务器的IP:192.168.3.10

Swit2(vtp client)

VLAN1;192.168.1.3/24

1.  配置接口的IP地址并使相邻设备ping的通,并配置好交换机12的网关。192.168.1.1(在全局模式下输入ip default-gateway 192.168.1.1),用show ip int br 命令查看接口的状态是up 还是down

2.  为每台路由器和交换机配置控制台密码、使能口令,所有依次copy就行了。

sw1(config)#line vty 0 4

sw1(config-line)#password cisco (控制台密码)

sw1(config-line)#login

sw1(config-line)#exit

sw1(config)#enable secret cisco (使能口令)

sw1(config)#service password-encryption (加密所有密码)

R2路由器去telnet R1 ,并查看密码的配置

r2#telnet 10.1.1.1

Trying 10.1.1.1 ...Open

   

User Access Verification

   

Password:   cisco (这里的密码都是不会显示的)

r1>en

Password:  cisco  

r1#show runn

enable secret 5  $1$mERr$hx5rVt7rPNoS4wqbXKX7m0 (显示的是加密了的)

line con 0

line vty 0 4

 password 7  0822455D0A16

 login

3.  r1#show runn 配置STP使Swit1成为根网桥

Swit1(config)#  spanning-tree vlan 1-3 priority 4096

4.  配置VTP使Swit1vtp server  Swit2 vtp client,Swit1F0/1-3都设置为TUNK链路,并让Swit2的交换机能学习到Swit1VLAN2\VLAN3,然后把接口加入相关的VLAN中,可以用show vlan\ show vtp status 查看配置。

VTP的配置

    sw1(config)#vtp domain be (把sw1加入BE域中)

    sw 2 (config)#vtp domain be (把sw2加入BE域中)

    sw2(config)#vtp mode client (把sw2配置为客户机,因为默认交换机是服务器模式,所以sw1不做配置 )

   接口的配置

    sw 1 (config)#in f0/ 4

    sw 1 (config-if)#swit access vlan 2

sw 1 (config-if)#exit

sw 1 (config)#in f0/ 5

sw 1 (config-if)#swit access vlan  3

    sw2(config)#in f0/3

    sw2(config-if)#swit access vlan 2

sw2(config-if)#exit

sw2(config)#in f0/4

sw2(config-if)#swit access vlan  3

 配置查看

sw2#show vlan 

 

2    VLAN0002                         active    Fa0/3

3    VLAN0003                         active    Fa0/4

sw2#show vtp status 

VTP Version                     : 2

Configuration Revision          : 2

Maximum VLANs supported locally : 255

Number of existing VLANs        : 7

VTP Operating Mode              : Client

5.配置单臂路由,配置DHCP自动为客户机分配IP地址,让局域网的主机能通信

   单臂路由的配置

    r1(config)#in f0/0.1

    r1(config-subif)#encapsulation dot1Q 1

r1(config-subif)#ip add 192.168.1.1 255.255.255.0

r1(config)#in f0/0. 2

r1(config-subif)#encapsulation dot1Q 2

r1(config-subif)#ip add 192.168.2.1 255.255.255.0

r1(config)#in f0/0. 3

r1(config-subif)#encapsulation dot1Q 3

r1(config-subif)#ip add 192.168.3.1 255.255.255.0

DHCP的配置

r1(config)#ip dhcp excluded-address 192.168.2.1

r1(config)#ip dhcp pool 2 (地址池的名字)

r1(dhcp-config)#network 192.168.2.10  255.255.255.0(动态分配置的IP地址)

192.168.2.10 / 192.168.2.254 is an invalid network

r1(dhcp-config)#default-router 192.168.2.1 (DHCP的网关地址)

r1(dhcp-config)#dns-server 92.1.1.10 (DNS服务器的地址)

r1(config)#ip dhcp excluded-address 192.168. 3 .1

r1(config)#ip dhcp pool  3

r1(dhcp-config)#network 192.168. 3 .10  255.255.255.0

192.168. 3 .10 / 192.168. 3 .254 is an invalid network

r1(dhcp-config)#default-router 192.168. 3 .1

r1(dhcp-config)#dns-server 92.1.1.10

PC 3 >ping 192.168.2.2  (各主机互ping都能通)

Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=125ms TTL=127

Reply from 192.168.2.2: bytes=32 time=109ms TTL=127

Reply from 192.168.2.2: bytes=32 time=111ms TTL=127

Reply from 192.168.2.2: bytes=32 time=125ms TTL=127

6.R1R2之间配置PPP协议,并做一条到R2(Intenet)的默认路由

    r1(config)#user r2 password cisco

r1(config)#in s0/3/0

r1(config-if)#encapsulation ppp

r1(config-if)#ppp authentication chap

r1(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.2

r2(config)#username r1 password cisco

r2(config)#in s0/3/0

r2(config-if)#encapsulation ppp

r2(config-if)#ppp authentication chap

r1(config-if)#  shut

r1(config-if)# no shut(重新启动接口,使接口启用CHAP认证)

r1(config-if)# do  ping 10.1.1.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 15/24/31 ms

7.分别在R2\R3\R4上配置OSPF路由协议

    r2(config)#router ospf 100

r2(config-router)#network 10.1.1.0 0.0.0.255 a 0

r2(config-router)#network 20.1.1.0 0.0.0.255 a 0

r2(config-router)#network 30.1.1.0 0.0.0.255 a 0

r3(config)#router ospf 100

r3(config-router)#network 20.1.1.0 0.0.0.255 a 0

r3(config-router)#network 40.1.1.0 0.0.0.255 a 0

r3(config-router)#network 82.1.1.0 0.0.0.255 a 0

r4(config)#router ospf 100

r4(config-router)#network 30.1.1.0 0.0.0.255 a 0

r4(config-router)#network 40.1.1.0   0.0.0.255 a 0

r4(config-router)#network 92.1.1.0 0.0.0.255 a 0

r2#show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface

82.1.1.1          1   FULL/BDR        00:00:35    20.1.1.2        FastEthernet0/0

92.1.1.1          1   FULL/BDR        00:00:33    30.1.1.2        FastEthernet0/1

r3#show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface

30.1.1.1          1   FULL/DR         00:00:36    20.1.1.1        FastEthernet0/0

92.1.1.1          0   FULL/  -        00:00:38    40.1.1.2        Serial0/0

r4#show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface

30.1.1.1          1   FULL/DR         00:00:38    30.1.1.1        FastEthernet0/0

82.1.1.1          0   FULL/  -        00:00:36    40.1.1.1        Serial0/0

8.R1上配置动态PAT使内部用户通过公用地址上网,并开启TLENET通过2323管理sw1,用一台PCping 外网,然后用shwo ip nat tr 查看地址的转换

r1(config)#in f0/0.2

r1(config-subif)#ip nat inside  (允许进入的流量)

r1(config-subif)#in f0/0.3

r1(config-subif)#ip nat inside

r1(config-subif)#exit

r1(config)#access-list 1 permit 192.168.2.0 0.0.0.255

r1(config)#access-list 1 permit 192.168.3.0 0.0.0.255

r1(config)#ip nat inside source list 1 interface s0/3/0 overload

r1(config)# in s0/3/0

r1(config -if)#ip nat outside(允许出去的流量)

r1(config)#in f0/0.1

r1(config-subif)#ip nat inside

r1(config)#ip nat inside source static tcp 192.168.1.2 23 10.1.1.1  2000(允许远程管理SW1交换机)

r1#show ip nat tr

Pro  Inside global     Inside local       Outside local      Outside global

icmp 10.1.1.1:10       192.168.2.3:10     10.1.1.2:10        10.1.1.2:10

icmp 10.1.1.1:11       192.168.2.3:11     10.1.1.2:11        10.1.1.2:11

icmp 10.1.1.1:12       192.168.2.3:12     10.1.1.2:12        10.1.1.2:12

icmp 10.1.1.1:9        192.168.2.3:9      10.1.1.2:9         10.1.1.2:9

tcp 10.1.1.1:2000      192.168.1.2:23     ---                ---

vlan3 中的主机去访问外网网站www.baidu.com(92.1.1.10)

9.vlan 3中的主机不能访问 www.baidu.com 服务器,然后在访问如下图

    r1(config)#access-list 100 deny tcp 192.168.3.0 0.0.0.255 host 92.1.1.10 eq 80

r1(config)#access-list 100 permit   ip any any

r1(config-subif)#ip access-group 100 in

虽然不能访问网站,但是可以ping 

       
10.把公司内部网站发布出去 www.benet.com ,,然后用远程笔记本来访问发布的公司的内部网站,记住一定要输入正确 www.benet.com:8080 才能访问的到

r1(config)#ip nat inside source static tcp 192.168.3.10 80 10.1.1.1 8080