首先给给c1和c2 分vlan 在 交换机R5上设置 R5>en R5#conf t R5(config)#vlan 10 R5(config-vlan)#vlan 20 R5(config-vlan)#inter fa1/1 R5(config-if)#switchport access vlan 10 R5(config-if)#inter fa1/2 R5(config-if)#switchport access vlan 20 R5(config-if)#inter fa1/0 R5(config-if)#switchport mode trunk R5(config-if)#switchport trunk encapsulation d R5(config-if)#switchport trunk encapsulation dot1q 然后设置DHCP地址池 dhcp>en dhcp#conf t dhcp(config)#ip dhcp p dhcp(config)#ip dhcp pool dhcp(config)#ip dhcp pool v10 dhcp(dhcp-config)#netw dhcp(dhcp-config)#network 192.168.10.0 255.255.255.0 dhcp(dhcp-config)#de dhcp(dhcp-config)#default-router 192.168.10.1 dhcp(dhcp-config)#ip dhcp pool v20 dhcp(dhcp-config)#default-router 192.168.20.1 dhcp(dhcp-config)#network 192.168.20.0 255.255.255.0 dhcp(dhcp-config)#inter fa0/0 dhcp(config-if)#ip add dhcp(config-if)#ip address 192.168.100.100 255.255.255.0 dhcp(config-if)#no shut dhcp(config-if)#end dhcp(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.10 dhcp(config)#do ping 192.168.100.10 Sending 5, 100-byte ICMP Echos to 192.168.100.10, timeout is 2 seconds: .!!!! 然后设置DHCP中继 在R3上配置! R3>en R3#conf t R3(config)#vlan 10 R3(config-vlan)#vlan 20 R3(config-vlan)#inter vlan 10 R3(config-if)#ip address 192.168.10.1 255.255.255.0 R3(config-if)#ip helper-address 192.168.100.100 R3(config-if)#no shut R3(config-if)#inter vlan 20 R3(config-if)#ip helper-address 192.168.100.100 R3(config-if)#ip address 192.168.20.1 255.255.255.0 R3(config-if)#no shut R3(config-if)#inter fa1/1 R3(config-if)#switchport mode trunk R3(config-if)#switchport trunk encapsulation dot1q R3(config-if)#inter f0/0 R3(config-if)#sw R3(config-if)#ip add R3(config-if)#ip address 192.168.100.10 255.255.255.0 ig-if)#no shut R3(config-if)#inter fa1 R3(config-if)#inter fa1/2 R3(config-if)#no switchport R3(config-if)#ip address 192.168.200.10 255.255.255.0 R3(config-if)#no shut R3(config)#ip default-gateway 192.168.100.1 R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.200.1 R3#ping 192.168.200.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.200.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 16/31/52 ms R3#ping 202.106.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 202.106.1.2, timeout is 2 seconds: !!!!! R3要有3条直连路由。 一条默认路由。 R1要有2条直连和两条静态 在出口路由上配置! interface FastEthernet0/0 ip address 192.168.200.1 255.255.255.0 ip nat inside interface FastEthernet0/1 ip address 202.106.1.1 255.255.255.252 ip nat outside ip virtual-reassembly duplex auto speed auto ip route 192.168.10.0 255.255.255.0 192.168.200.10 ip route 192.168.20.0 255.255.255.0 192.168.200.10 ip nat inside source list 1 interface FastEthernet0/1 overload access-list 1 permit 192.168.0.0 0.0.255.255 S 192.168.10.0/24 [1/0] via 192.168.200.10 202.106.1.0/30 is subnetted, 1 subnets C 202.106.1.0 is directly connected, FastEthernet0/1 C 192.168.200.0/24 is directly connected, FastEthernet0/0 S 192.168.20.0/24 [1/0] via 192.168.200.10 R1#ping 202.106.1.2 source 192.168.200.1 Sending 5, 100-byte ICMP Echos to 202.106.1.2, timeout is 2 seconds: Packet sent with a source address of 192.168.200.1 .!!!!
R4>en R4#conf t R4(config)#inter fa0/0 R4(config-if)#ip address 202.106.1.2 255.255.255.252 R4(config-if)#no shut ok ping通外网了! |
转载于:https://blog.51cto.com/bobolee/1165695