A-A+

单臂路由和DHCP集成实验的拓扑图和配置命令行

2015年11月23日 站长资讯 暂无评论

网络拓扑图比较简单,所以通过文字描述一下就行了:一台交换机连接一台路由器之后,再连接4台PC客户端(PC0到PC3):

下面是路由器配置的全部命令行:

  1. Current configuration : 1351 bytes   
  2. !   
  3. version 12.2   
  4. no service timestamps log datetime msec   
  5. no service timestamps debug datetime msec   
  6. no service password-encryption   
  7. !   
  8. hostname Router   
  9. !   
  10. ip dhcp excluded-address 192.168.20.1   
  11. ip dhcp excluded-address 192.168.20.2   
  12. ip dhcp excluded-address 192.168.20.4   
  13. ip dhcp excluded-address 192.168.20.3   
  14. ip dhcp excluded-address 192.168.30.1   
  15. ip dhcp excluded-address 192.168.30.2   
  16. ip dhcp excluded-address 192.168.30.3   
  17. ip dhcp excluded-address 192.168.30.4   
  18. !   
  19. ip dhcp pool vlan20   
  20. network 192.168.20.0 255.255.255.0   
  21. default-router 192.168.20.1   
  22. dns-server 202.96.134.133   
  23. ip dhcp pool vlan30   
  24. network 192.168.30.0 255.255.255.0   
  25. default-router 192.168.30.1   
  26. dns-server 202.96.134.133   
  27. !   
  28. interface FastEthernet0/0   
  29. no ip address   
  30. duplex auto   
  31. speed auto   
  32. !  
  33.   
  34.   
  35. interface FastEthernet0/0.1   
  36. encapsulation dot1Q 20   
  37. ip address 192.168.30.1 255.255.255.0   
  38. !   
  39. interface FastEthernet0/0.2   
  40. encapsulation dot1Q 30   
  41. ip address 192.168.20.1 255.255.255.0   
  42. !   
  43. interface FastEthernet1/0   
  44. no ip address   
  45. duplex auto   
  46. speed auto   
  47. shutdown   
  48. !   
  49. interface Serial2/0   
  50. no ip address   
  51. clock rate 2000000   
  52. shutdown   
  53. !   
  54. interface Serial3/0   
  55. no ip address   
  56. clock rate 2000000   
  57. shutdown   
  58. !   
  59. interface FastEthernet4/0   
  60. no ip address   
  61. shutdown   
  62. !   
  63. interface FastEthernet5/0   
  64. no ip address   
  65. shutdown   
  66. !   
  67. ip classless   
  68. !   
  69. line con 0   
  70. line vty 0 4   
  71. login   
  72. !   
  73. end   

交换机配置:

  1. Current configuration : 1260 bytes   
  2. !   
  3. version 12.2   
  4. no service timestamps log datetime msec   
  5. no service timestamps debug datetime msec   
  6. no service password-encryption   
  7. !   
  8. hostname Switch   
  9. !   
  10. !   
  11. spanning-tree mode pvst   
  12. !   
  13. interface FastEthernet0/1   
  14. switchport mode trunk   
  15. !   
  16. interface FastEthernet0/2   
  17. switchport access vlan 20   
  18. switchport mode access   
  19. !   
  20. interface FastEthernet0/3   
  21. switchport access vlan 20   
  22. switchport mode access   
  23. !   
  24. interface FastEthernet0/4   
  25. switchport access vlan 30   
  26. switchport mode access   
  27. !   
  28. interface FastEthernet0/5   
  29. switchport access vlan 30   
  30. switchport mode access   
  31. !   
  32. line con 0   
  33. !   
  34. line vty 0 4   
  35. login   
  36. line vty 5 15   
  37. login   
  38. !   
  39. end   

实现效果:PC0和PC1自动从路由器获得VLAN 30网段的IP地址;PC2,PC3自动从路由器获得VLAN 20网段的IP地址。

标签:

给我留言