A-A+

单臂路由DHCP和VTP的一次通信试验

2016年01月06日 路由器高级应用 暂无评论 阅读 6 views 次

1.实验拓扑:

使用GNS3模拟器(版本0.8.6)

2.实验需求:

a)C1和C3是vlan10成员,C2和C4是vlan20成员

b)配置VTP使SW3自动学习vlan信息

c)在R1上配置DHCP为所有成员分配IP

d)所有成员互通

3.实验步骤:

a) IP地址划分:

vlan10成员的网关:192.168.10.1

vlan20成员的网关:192.168.20.1

b)配置脚本:

SW1的配置如下:

  1. SW1#conf t  
  2. SW1(config)#no ip routing  //关闭路由功能  
  3. SW1(config)#vlan 10,20  //同时添加vlan 10 vlan20  
  4. SW1(config)#int f1/1  
  5. SW1(config-if)#switchport access vlan 10 //把f1/1以访问模式加入到vlan10中  
  6. SW1(config-if)# int f1/2  
  7. SW1(config-if)#switchport access vlan 20  
  8. SW1(config-if)# int f1/3  
  9. SW1(config-if)#switchport access vlan 10  
  10. SW1(config-if)# int f1/11  
  11. SW1(config-if)#switchport mode trunk //把f1/11接口变成中继模式  
  12. SW1(config-if)# int f1/10  
  13. SW1(config-if)#switchport mode trunk  
  14. SW1(config-if)#exit  
  15. SW1(config)#vtp domain test  //创建vtp域  
  16. SW1(config)#vtp password abc  //vtp域添加密码  
  17. SW1(config)#vtp pruning  //配置vtp修剪  

SW2的配置如下:

  1. SW2#conf t  
  2. SW2(config)#no ip routing  
  3. SW2(config)#int f1/11  
  4. SW2(config-if)#switchport mode trunk  
  5. SW2(config-if)#exit  
  6. SW2(config)#vtp domain test  
  7. SW2(config)#vtp mode client  
  8. SW2(config)#vtp password abc  
  9. SW2(config)#vtp pruning  
  10. SW2(config)#int f1/1  
  11.             SW2(config-if)#switchport access vlan 20  

R1的配置如下:

  1. R1#conf t  
  2. R1(config)int f0/0  
  3. R1(config-if)#no shut  //激活接口  
  4. R1(config-if)#int f0/0.10  //进子接口  
  5. R1(config-subif)#encapsulation dot1Q 10  //把这个子接口做vlan10的网关  
  6. R1(config-subif)#ip add 192.168.10.1255.255.255.0  
  7. R1(config-subif)#no shut  
  8. R1(config-subif)#int f0/0.20  
  9. R1(config-subif)#encapsulation dot1Q 20  
  10. R1(config-subif)#ip add 192.168.20.1255.255.255.0  
  11. R1(config-subif)#no shut  
  12. R1(config-subif)#exit  
  13. R1(config)#ip dhcp pool v10  //定义IP地址池为v10  
  14. R1(dhcp-config)#network 192.168.10.0 /24  //动态分配IP地址段  
  15. R1(dhcp-config)#default-router 192.168.10.1  //设置网关  
  16. R1(dhcp-config)#dns-server 8.8.8.8  //配置DNS  
  17. R1(config-subif)#exit  
  18. R1(config)#ip dhcp pool v20  
  19. R1(dhcp-config)#network 192.168.20.0 /24  
  20. R1(dhcp-config)#default-router 192.168.20.1  
  21. R1(dhcp-config)#dns-server 8.8.8.8  

4.验证结果:

a)C1和C3属于vlan10,C2和C4属于vlan20

b)vtp自动学习vlan信息。

c)DHCP让所有成员自动获取IP地址。

d)全网互通。

标签:

给我留言