networking地图的截图
networking非常简单。 nat / WAN接入路由器,Intervlan路由的三层交换机。
路由器:
ip nat inside source list nated-nets interface FastEthernet0/0 overload ip access-list extended nated-nets permit ip 192.168.10.0 0.0.0.255 any permit ip 192.168.11.0 0.0.0.255 any permit ip 192.168.12.0 0.0.0.255 any interface FastEthernet0/0 description [f0/0][ISP] ip address dhcp no ip redirects no ip unreachables no ip proxy-arp ip nat outside ip virtual-reassembly in duplex auto speed auto interface FastEthernet0/1.10 description [f0/1.10][vlan10] encapsulation dot1Q 10 ip address 192.168.10.254 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip nat inside ip virtual-reassembly in interface FastEthernet0/1.11 description [f0/1.11][vlan11] encapsulation dot1Q 11 ip address 192.168.11.254 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip nat inside ip virtual-reassembly in interface FastEthernet0/1.12 description [f0/1.12][vlan12] encapsulation dot1Q 12 ip address 192.168.12.254 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip nat inside ip virtual-reassembly in
开关:
interface range gigabitEthernet 0/1-7 switchport mode access switchport access vlan 10 spanning-tree portfast switchport nonegotiate interface range gigabitEthernet 0/8-14 switchport mode access switchport access vlan 11 spanning-tree portfast switchport nonegotiate interface range gigabitEthernet 0/15-21 switchport mode access switchport access vlan 12 spanning-tree portfast switchport nonegotiate interface GigabitEthernet0/24 description [g0/24][router] switchport trunk encapsulation dot1q switchport trunk allowed vlan 10-12 switchport mode trunk switchport nonegotiate load-interval 30 carrier-delay msec 0 spanning-tree portfast trunk interface Vlan10 ip address 192.168.10.1 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip policy route-map vlan10 interface Vlan11 ip address 192.168.11.1 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip policy route-map vlan11 interface Vlan12 ip address 192.168.12.1 255.255.255.0 no ip redirects no ip unreachables no ip proxy-arp ip policy route-map vlan12 route-map vlan10 permit 10 match ip address vlan-gateway set ip next-hop 192.168.10.254 route-map vlan11 permit 10 match ip address vlan-gateway set ip next-hop 192.168.11.254 route-map vlan12 permit 10 match ip address vlan-gateway set ip next-hop 192.168.12.254 ip access-list extended vlan-gateway deny ip 192.168.10.0 0.0.0.255 192.168.0.0 0.0.255.255 deny ip 192.168.11.0 0.0.0.255 192.168.0.0 0.0.255.255 deny ip 192.168.12.0 0.0.0.255 192.168.0.0 0.0.255.255 permit ip any any
交换路由表:
Switch# show ip route Gateway of last resort is not set C 192.168.10.0/24 is directly connected, Vlan10 C 192.168.11.0/24 is directly connected, Vlan11 C 192.168.12.0/24 is directly connected, Vlan12
预期成果 :
来源IP:192.168.10.25
目标IP:192.168.11.15
路由:192.168.10.25 – > 192.168.10.1 – > 192.168.11.15
来源IP:192.168.10.25
目标IP地址:8.8.8.8
路由:192.168.10.25 – > 192.168.10.1 – > 192.168.10.254 – > ISP
我试图避免的事情 :
来源IP:192.168.10.25
目标IP:192.168.11.15
路由:192.168.10.25 – > 192.168.10.1 – > 192.168.10.254 – > 192.168.11.15
来源IP:192.168.10.25
目标IP地址:8.8.8.8
路由:192.168.10.25 – > 192.168.10.1 – > 192.168.11.254 – > ISP
虽然这个configuration可以工作,但感觉马虎。
查看访问列表时,我也看到意想不到的结果。 我有12个terminal窗口在其他本地子网打开IP,5个ping外部子网,我有一堆随机的YouTube,藤,脸谱,和其他数据包聊天丰富的网站打开。 我认为这个数字会更高。
Extended IP access list vlan-gateway 10 deny ip 192.168.10.0 0.0.0.255 192.168.0.0 0.0.255.255 20 deny ip 192.168.11.0 0.0.0.255 192.168.0.0 0.0.255.255 (478 matches) 30 deny ip 192.168.12.0 0.0.0.255 192.168.0.0 0.0.255.255 (3062 matches) 40 permit ip any any (47 matches)
使用您当前的configuration,您不在交换机上执行VLAN间路由; 你在路由器上这样做 。 这是不好的,其中主要的原因是,从一个VLAN到另一个VLAN的所有stream量正在通过中继线连接和路由器(这造成瓶颈)。 另外,你说你想用“路由器上的nat /广域网接入,第三层交换机进行intervlan路由”,所以你现在做的实际上不是你想要做的。
由于您的交换机具有三层function,因此只需在每个VLAN(已拥有该VLAN)上为其指定一个IP地址,并使用命令ip routing启用IP ip routing ; 这将处理VLAN间的路由。
然后,您需要修改networking映射,以使用不同的IP子网将交换机连接到路由器,而不是通过中继连接将所有VLAN传送到路由器; 您还必须将交换机configuration为使用路由器作为其默认网关。 路由器configuration将需要相应地修改:到交换机的单一连接,以及一些路由表条目,告诉它“您可以通过到交换机的连接到达这些内部IP子网”。 最后但并非最不重要,每个VLAN中的所有计算机都需要使用该VLAN(192.168.10.1,192.168.11.1或192.168.12.1)中的交换机接口作为其默认网关。
这将实现你所要求的:
Source IP: 192.168.10.25 Destination IP: 192.168.11.15 Route: 192.168.10.25 --> 192.168.10.1 --> 192.168.11.15 Source IP: 192.168.10.25 Destination IP: 8.8.8.8 Route: 192.168.10.25 --> 192.168.10.1 --> Router --> ISP
这里是修改后的networking图(路由器交换机连接使用192.168.42.0/24):
以下是交换机的相应示例configuration(为简洁起见,省略了一些详细信息):
interface range gigabitEthernet 0/1-7 switchport mode access switchport access vlan 10 interface range gigabitEthernet 0/8-14 switchport mode access switchport access vlan 11 interface range gigabitEthernet 0/15-21 switchport mode access switchport access vlan 12 interface GigabitEthernet0/24 ip address 192.168.42.42 255.255.255.0 interface Vlan10 ip address 192.168.10.1 255.255.255.0 interface Vlan11 ip address 192.168.11.1 255.255.255.0 interface Vlan12 ip address 192.168.12.1 255.255.255.0 ip routing ip route 0.0.0.0 0.0.0.0 192.168.42.1
这里是路由器的相应示例configuration(同样为了简洁,省略了一些细节):
ip access-list extended nated-nets permit ip 192.168.10.0 0.0.0.255 any permit ip 192.168.11.0 0.0.0.255 any permit ip 192.168.12.0 0.0.0.255 any permit ip 192.168.42.0 0.0.0.255 any ip nat inside source list nated-nets interface FastEthernet0/0 overload interface FastEthernet0/0 ip address dhcp ip nat outside interface FastEthernet0/1 ip address 192.168.42.1 255.255.255.0 ip nat inside ip route 192.168.10.0 255.255.255.0 192.168.42.42 ip route 192.168.11.0 255.255.255.0 192.168.42.42 ip route 192.168.12.0 255.255.255.0 192.168.42.42
当然,这可以进一步优化(不需要仅连接两个设备的24子网,这些路由表条目可以很容易地合并)。 但这应该足以让你开始。
访问列表的提示是非常奇怪的,也许你可以使用debuggingIP数据包访问列表或wireshark查看详细信息但是,这种devise是exception的,没有思科最佳实践,因为你避免头孢菌素和增加子处理转发。