1、建立网络拓扑图
2、对于局部进行配置
3、对交换机S0、S1进行相同配置Switch>enSwitch#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Switch(config)#vlan 10Switch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#exitSwitch(config)#int f0/1Switch(config-if)#switch access vlan 10Switch(config-if)#exitSwitch(config)#int f0/2Switch(config-if)#switch access vlan 20Switch(config-if)#exitSwitch(config)#int f0/24Switch(config-if)#switch mode tSwitch(config-if)#%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to upSwitch(config-if)#
4、对三级交换机进行配置Switch>enSwit罕铞泱殳ch#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Switch(config)#vlan 10Switch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#exitSwitch(config)#vlan 30Switch(config-vlan)#exitSwitch(config)#int vlan 10Switch(config-if)#%LINK-5-CHANGED: Interface Vlan10, changed state to upSwitch(config-if)#ip address 192.168.1.1 255.255.255.0Switch(config-if)#exitSwitch(config)#int vlan 20Switch(config-if)#%LINK-5-CHANGED: Interface Vlan20, changed state to upSwitch(config-if)#ip address 192.168.2.1 255.255.255.0Switch(config-if)#exitSwitch(config)#int vlan 30Switch(config-if)#%LINK-5-CHANGED: Interface Vlan30, changed state to upSwitch(config-if)#ip address 192.168.3.1 255.255.255.0Switch(config)#int f0/24Switch(config-if)#switch access vlan 30Switch(config-if)#exitSwitch(config)#ip routingSwitch(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.2 Switch(config)#ip dhcp pool 123Switch(dhcp-config)#network 192.168.1.0 255.255.255.0Switch(dhcp-config)#deSwitch(dhcp-config)#default-router 192.168.1.1Switch(dhcp-config)#dnsSwitch(dhcp-config)#dns-server 8.8.8.8Switch(dhcp-config)#exitSwitch(config)#ip dhcp pool 456Switch(dhcp-config)#network 192.168.2.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.2.1Switch(dhcp-config)#dns-server 8.8.8.8
5、电脑选择自动获取IP地址,对上方电脑单独配置
6、对左侧单臂路由进行配置
7、对于服务器进行配置
8、对交换机进行配置Switch>enSwitch#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Switch(config)#vlan 40Switch(config-vlan)#exitSwitch(config)#vlan 50Switch(config-vlan)#exitSwitch(config)#int f0/1Switch(config-if)#switch access vlan 40Switch(config-if)#exitSwitch(config)#int f0/2Switch(config-if)#switch access vlan 50Switch(config)#int f0/24Switch(config-if)#switch mode t
9、对路由器进行配置Router>enRouter拭貉强跳#confConfiguring from terminal, memory, or network [termin锾攒揉敫al]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/1Router(config-if)#no ip addressRouter(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#int f0/1.10Router(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/1.10, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.10, changed state to upRouter(config-subif)#encRouter(config-subif)#encapsulation dot1q 40Router(config-subif)#ip address 192.168.6.1 255.255.255.0% Configuring IP routing on a LAN subinterface is only allowed if thatsubinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,or ISL vLAN.Router(config-subif)#exitRouter(config)#int f0/1.20Router(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/1.20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.20, changed state to upRouter(config-subif)#encapsulation dot1q 50Router(config-subif)#ip address 192.168.7.1 255.255.255.0% Configuring IP routing on a LAN subinterface is only allowed if thatsubinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,or ISL vLAN.Router(config-subif)#exitRouter(config-subif)#endRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#Router>enRouter#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/1Router(config-if)#no ip addressRouter(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#int f0/1.10Router(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/1.10, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.10, changed state to upRouter(config-subif)#ip address 192.168.6.1 255.255.255.0% Configuring IP routing on a LAN subinterface is only allowed if thatsubinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,or ISL vLAN.Router(config-subif)#encRouter(config-subif)#encapsulation dot1q 40Router(config-subif)#exitRouter(config)#int f0/1.20Router(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/1.20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.20, changed state to upRouter(config-subif)#ip address 192.168.7.1 255.255.255.0% Configuring IP routing on a LAN subinterface is only allowed if thatsubinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,or ISL vLAN.Router(config-subif)#encapsulation dot1q 50Router(config-subif)#exitRouter#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/0Router(config-if)#ip address 192.168.5.2 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to upRouter(config-if)#exitRouter(config)#ip route 192.168.1.0 255.255.255.0 192.168.5.1Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.5.1Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.5.1Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.5.1Router(config)#ip route 192.168.8.0 255.255.255.0 192.168.5.1Router(config)#ip route 192.168.9.0 255.255.255.0 192.168.5.1以上路由表可用默认路由代替Router(config)#ip route 0.0.0.0 0.0.0.0 f0/0 {192.168.5.1 }Router(config)#endRouter#Router>Router>enRouter#Router#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 192.168.6.10 eq wwwRouter(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 192.168.7.10 eq wwwRouter(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.6.10Router(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.7.10Router(config)#access-list 101 permit tcp 192.168.2.0 0.0.0.255 host 192.168.7.10 eq wwwRouter(config)#access-list 101 deny tcp 192.168.2.0 0.0.0.255 host 192.168.6.10 eq wwwRouter(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.7.10Router(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.6.10Router(config)#int f0/0Router(config-if)#ip access-group 101 inRouter(config-if)#exit
10、对各路由器
11、对路由器R0(与三级交换机相连的)进行配置Router>enRouter#confConfiguring from termin锾攒揉敫al, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/0Router(config-if)#ip address 192.168.4.2 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to upRouter(config-if)#exitRouter(config)#Router(config)#int f0/1Router(config-if)#ip address 192.168.3.2 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.2%Invalid next hop address (it's this router)Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1Router(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.1Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.4.1Router(config)#ip route 192.168.7.0 255.255.255.0 192.168.4.1Router(config)#ip route 192.168.8.0 255.255.255.0 192.168.4.1Router(config)#ip route 192.168.9.0 255.255.255.0 192.168.4.1Router(config)#
12、给R1添加模块,进行配置Router>enRouter#confConfiguring from terminal, memory, 泠贾高框or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/1Router(config-if)#ip address 192.168.4.1 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#int f0/0Router(config-if)#ip address 192.168.5.1 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int e0/1/0Router(config-if)#ip address 192.168.8.1 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface Ethernet0/1/0, changed state to upRouter(config-if)#exitRouter(config)#ip nat pool net6 192.168.8.10 192.168.8.100 netmask 255.255.255.0Router(config)#access-list 1 permit 192.168.2.0 0.0.0.255Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255Router(config)#ip nat ins sour list 1 pool net6Router(config)#int f0/1Router(config-if)#ip nat insRouter(config-if)#exitRouter(config)#int e0/1/0Router(config-if)#ip nat outRouter(config-if)#exitRouter(config)#ip route 192.168.9.0 255.255.255.0 e0/1/0Router(config)#ip route 192.168.1.0 255.255.255.0 f0/1Router(config)#ip route 192.168.2.0 255.255.255.0 f0/1Router(config)#ip route 192.168.3.0 255.255.255.0 f0/1Router(config)#ip route 192.168.6.0 255.255.255.0 f0/0Router(config)#ip route 192.168.7.0 255.255.255.0 f0/0注意端口不要连错
13、对最上面一台路由器Router>enRouter#confConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#int f0/0Router(config-if)#ip address 192.168.8.200 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#exitRouter(config)#int f0/1Router(config-if)#ip address 192.168.9.1 255.255.255.0Router(config-if)#no shutRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#ip route 0.0.0.0 0.0.0.0 f0/0Router(config)#
14、在PC1上ping PC5 能通ping 服务器不通 但能访问6.10的www在PC2上ping PC5 能通ping 服务器不通 但能访问7.10的www