Cisco 综合配置(三)
要求:
1、PC1 PC2使用DHCP,获取IP ,VLAN为10 和20,网关在Core Switch 2上
2、DHCP和web server VLAN为100,网关在Core Switch 1上
3、Switch1 和Switch2 ,采用端口聚合通道,管理VLAN253
4、PC和WEB都能通过访问外网,web能被访问, 80端口映射为8080
配置:
Switch 1:
Switch(config)#vlan 20
Switch(config-vlan)#vlan 10
Switch(config-vlan)#vlan 253
Switch(config-vlan)#exit
Switch(config)#interface f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface f0/4
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#interface vlan 253
Switch(config-if)#ip address 192.168.253.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#inter range f0/2 -3
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#exit
Switch(config)#interface port-channel 1
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch 2:
Switch>enable
Switch#configure t
Switch(config)#vlan 20
Switch(config-vlan)#vlan 253
Switch(config-vlan)#exit
Switch(config)#inter f0/1
Switch(config-if)#switchport mode acc
Switch(config-if)#swit acc vlan 20
Switch(config-if)#inter vlan 253
Switch(config-if)#ip address 192.168.253.2 255.255.255.0
Switch(config-if)#exit
Switch(config)#ip default-gateway 192.168.253.254
Switch(config)#inter range f0/2 -3
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#exit
Switch(config)#interface port-channel 1
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#
WEB server:
Router>en
Router#conf t
Router(config)#no ip routing
Router(config)#inter fastEthernet 0/0
Router(config-if)#ip address 192.168.100.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip default-gateway 192.168.100.254
DHCP server:
Router>en
Router>enable
Router#conf t
Router(config)#no ip routing
Router(config)#inter f0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.100.1 255.255.255.0
Router(config)#ip default-gateway 192.168.100.254
Router(config)#exit
Router(config)#server dhcp
Router(config)#ip dhcp pool vlan10
Router(dhcp-config)#network 192.168.10.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.10.254
Router(dhcp-config)#exit
Router(config)#ip dhcp pool vlan20
Router(dhcp-config)#network 192.168.20.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.20.254
Router(dhcp-config)#exit
Internet:
Router>
Router>en
Router#conf t
Router(config)#inter f0/0
Router(config-if)#ip address 202.101.100.2 255.255.255.224
Router(config-if)#no shutdown
Core Switch 1:
Switch>en
Switch#configure t
Switch(config)ip routing
Switch(config)#inter fastEthernet 0/3
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#vlan 100
Switch(config-vlan)#vlan 253
Switch(config-vlan)#exit
Switch(config)#inter vlan 100
Switch(config-if)#ip address 192.168.100.254 255.255.255.0
Switch(config)#inter vlan 253
Switch(config-if)#ip address 192.168.253.253 255.255.255.0
Switch(config-if)#exit
Switch(config)#inter range f0/1-2
Switch(config-if-range)# switchport acce vlan 100
Switch(config-if-range)#exit
Switch(config)#
Switch(config)ip route 0.0.0.0 0.0.0.0 192.168.253.254
Core Switch 2:
Switch>en
Switch#configure t
Switch(config)#inter fastEthernet 0/2
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 253
Switch(config-vlan)#exit
Switch(config)#inter f 0/1
Switch(config-if)#exit
Switch(config)#inter vlan 10
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#ip helper-address 192.168.100.1
Switch(config-if)#inter vlan 20
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#ip helper-address 192.168.100.1
Switch(config-if)#inter vlan 253
Switch(config-if)#ip ad 192.168.253.254 255.255.255.0
Switch(config-if)#ip helper-address 192.168.100.1
Switch(config-if)#exit
Switch(config)#interface f0/3
Switch(config-if)#no shutdown
Switch(config-if)#no switchport
Switch(config-if)#ip address 192.168.254.1 255.255.255.252
Switch(config-if)#exit
Switch(config)ip route 192.168.100.0 255.255.255.0 192.168.253.253
Switch(config)ip route 0.0.0.0 0.0.0.0 192.168.254.2
Out Router:
Router(config)#interface FastEthernet0/0
Switch(config-if)#ip address 192.168.254.2 255.255.255.252
Switch(config-if)#ip nat inside
Switch(config)#interface FastEthernet0/1
Switch(config-if)#ip address 202.101.100.1 255.255.255.224
Switch(config-if)#ip nat outside
Router(config)#exit
#配置NAT
Router(config)#access-list 1 permit 192.168.0.0 0.0.255.255
Router(config)#access-list 1 deny any
Router(config)#ip nat inside source list 1 interface f0/1 over
Router(config)##ip nat inside source static tcp 192.168.100.2 80 202.101.100.5 8080
Router(config)#ip route 192.168.0.0 255.255.255.0 192.168.254.1