设置四台PC机IP为DHCP自动获取
设置服务器的IP 192.168.6.1 子网 255.255.255.0 网关 192.168.6.254
在服务器上开启DHCP服务并设置地址池
SW1的配置:
创建vlan10,20:
SW1(config)#vlan 10
#vlan 20
将交换机之间的链路设置为trunk:
SW1(config)#interface range fa0/22,fa0/23,fa0/24
#switchport mode trunk
#switchport trunk allowed vlan all
将于pc相连的端口加入到vlan里:
SW1(config)#interface fastEthernet 0/1
#switchport mode access
#switchport access vlan 10
SW1(config)#interface fastEthernet 0/2
#switchport mode access
#switchport access vlan 20
SW2的配置:
创建vlan30,40:
SW2(config)#vlan 30
#vlan 40
将交换机之间的链路设置为trunk:
SW2(config)#interface range fa0/22,fa0/23,fa0/24
#switchport mode trunk
#switchport trunk allowed vlan all
将于pc相连的端口加入到vlan里:
SW2(config)#interface fastEthernet 0/3
#switchport mode access
#switchport access vlan 30
SW2(config)#interface fastEthernet 0/4
#switchport mode access
#switchport access vlan 40
SW3的配置:
创建vlan10 20 30 40:
SW3(config)#vlan 10
#vlan 20
#vlan 30
#vlan 40
将交换机之间的链路设置为trunk:
SW3(config)#interface range fa0/22,fa0/23,fa0/24
#switchport mode trunk
#switchport trunk allowed vlan all
sw4的配置:创建vlan10 20 30 40
SW4(config)#vlan 10
#vlan 20
#vlan 30
#vlan 40
将与交换机之间的链路设置为trunk:
SW4(config)#interface range fa0/22,fa0/23,fa0/24
#switchport mode trunk
#switchport trunk allowed vlan all
SW5的配置:
开启路由功能:
SW5(config)#ip routing
创建vlan10 20 30 40:
SW5(config)#vlan 10
#vlan 20
#vlan 30
#vlan 40
设置vlan10的ip并转发:
SW5(config)#interface vlan 10
#no shutdown
#ip address 192.168.10.250 255.255.255.0
#ip helper-address 192.168.6.1
设置vlan20的ip并转发:
SW5(config)#interface vlan 20
#no shutdown
#ip address 192.168.20.250 255.255.255.0
#ip helper-address 192.168.6.1
设置vlan30的ip并转发:
SW5(config)#interface vlan 30
#no shutdown
#ip address 192.168.30.250 255.255.255.0
#ip helper-address 192.168.6.1
设置vlan40的ip并转发:
SW5(config)#interface vlan 40
#no shutdown
#ip address 192.168.40.250 255.255.255.0
#ip helper-address 192.168.6.1
设置与路由器相连的端口ip:
SW5(config)#interface fastEthernet 0/22
#no shutdown
#ip address 192.168.5.1 255.255.255.0
设置静态路由:
SW5(config)#ip route 0.0.0.0 0.0.0.0 192.168.5.2
AR1:
设置与三层交换机链路的ip:
AR1(config)#interface gigabitEthernet 0/0
#no shutdown
#ip address 192.168.5.2 255.255.255.0
设置与服务器链路的ip:
AR1(config)#interface gigabitEthernet 0/1
#no shutdown
#ip address 192.168.6.254 255.255.255.0
设置一条静态路由:
AR1(config)# ip route 0.0.0.0 0.0.0.0 192.168.5.1
原文地址:http://blog.51cto.com/13557901/2060363