Cisco net动态地址池转换
1、建立网络拓扑图
2、对于局部进行配置
3、对交换机S0、S1进行相同配置
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#switch access vlan 10
Switch(config-if)#exit
Switch(config)#int f0/2
Switch(config-if)#switch access vlan 20
Switch(config-if)#exit
Switch(config)#int f0/24
Switch(config-if)#switch mode t
Switch(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 up
Switch(config-if)#
4、对三级交换机进行配置
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
Switch(config-if)#ip address 192.168.3.1 255.255.255.0
Switch(config)#int f0/24
Switch(config-if)#switch access vlan 30
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.2
Switch(config)#ip dhcp pool 123
Switch(dhcp-config)#network 192.168.1.0 255.255.255.0
Switch(dhcp-config)#de
Switch(dhcp-config)#default-router 192.168.1.1
Switch(dhcp-config)#dns
Switch(dhcp-config)#dns-server 8.8.8.8
Switch(dhcp-config)#exit
Switch(config)#ip dhcp pool 456
Switch(dhcp-config)#network 192.168.2.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.2.1
Switch(dhcp-config)#dns-server 8.8.8.8
5、电脑选择自动获取IP地址,对上方电脑单独配置
6、对左侧单臂路由进行配置
7、对于服务器进行配置
8、对交换机进行配置
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 40
Switch(config-vlan)#exit
Switch(config)#vlan 50
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#switch access vlan 40
Switch(config-if)#exit
Switch(config)#int f0/2
Switch(config-if)#switch access vlan 50
Switch(config)#int f0/24
Switch(config-if)#switch mode t
9、对路由器进行配置
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#no ip address
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/1.10
Router(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 up
Router(config-subif)#enc
Router(config-subif)#encapsulation dot1q 40
Router(config-subif)#ip address 192.168.6.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#exit
Router(config)#int f0/1.20
Router(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 up
Router(config-subif)#encapsulation dot1q 50
Router(config-subif)#ip address 192.168.7.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#exit
Router(config-subif)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#no ip address
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/1.10
Router(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 up
Router(config-subif)#ip address 192.168.6.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#enc
Router(config-subif)#encapsulation dot1q 40
Router(config-subif)#exit
Router(config)#int f0/1.20
Router(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 up
Router(config-subif)#ip address 192.168.7.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#encapsulation dot1q 50
Router(config-subif)#exit
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip address 192.168.5.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.8.0 255.255.255.0 192.168.5.1
Router(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)#end
Router#
Router>
Router>en
Router#
Router#conf
Configuring 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 www
Router(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 192.168.7.10 eq www
Router(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.6.10
Router(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.7.10
Router(config)#access-list 101 permit tcp 192.168.2.0 0.0.0.255 host 192.168.7.10 eq www
Router(config)#access-list 101 deny tcp 192.168.2.0 0.0.0.255 host 192.168.6.10 eq www
Router(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.7.10
Router(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.6.10
Router(config)#int f0/0
Router(config-if)#ip access-group 101 in
Router(config-if)#exit
10、对各路由器
11、对路由器R0(与三级交换机相连的)进行配置
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip address 192.168.4.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#
Router(config)#int f0/1
Router(config-if)#ip address 192.168.3.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(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.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
Router(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.7.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.8.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.9.0 255.255.255.0 192.168.4.1
Router(config)#
12、给R1添加模块,进行配置
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#ip address 192.168.4.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/0
Router(config-if)#ip address 192.168.5.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#int e0/1/0
Router(config-if)#ip address 192.168.8.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface Ethernet0/1/0, changed state to up
Router(config-if)#exit
Router(config)#ip nat pool net6 192.168.8.10 192.168.8.100 netmask 255.255.255.0
Router(config)#access-list 1 permit 192.168.2.0 0.0.0.255
Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)#ip nat ins sour list 1 pool net6
Router(config)#int f0/1
Router(config-if)#ip nat ins
Router(config-if)#exit
Router(config)#int e0/1/0
Router(config-if)#ip nat out
Router(config-if)#exit
Router(config)#ip route 192.168.9.0 255.255.255.0 e0/1/0
Router(config)#ip route 192.168.1.0 255.255.255.0 f0/1
Router(config)#ip route 192.168.2.0 255.255.255.0 f0/1
Router(config)#ip route 192.168.3.0 255.255.255.0 f0/1
Router(config)#ip route 192.168.6.0 255.255.255.0 f0/0
Router(config)#ip route 192.168.7.0 255.255.255.0 f0/0
注意端口不要连错
13、对最上面一台路由器
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip address 192.168.8.200 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int f0/1
Router(config-if)#ip address 192.168.9.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 f0/0
Router(config)#
14、在PC1上ping PC5 能通ping 服务器不通 但能访问6.10的www
在PC2上ping PC5 能通ping 服务器不通 但能访问7.10的www