DIY编程器网

标题: 多网段网络如何实现互联? [打印本页]

作者: admin    时间: 2014-10-13 13:32
标题: 多网段网络如何实现互联?
  不配置回指路由,就实现多网段网络互联,这有相当的实际需求。特别针对以下几种情况:
  1、随着网络的复杂化,本来局域网是一个网段。后来因需要划分了多个网段,但是由于机器较多逐个修改IP地址和网关比较麻烦的情况。
  2、出口的路由器为傻瓜产品无法自己添加静态路由,以及仅能对本地直连网段做NAT。
  3、懒人,连路由都懒的配的懒人或配不好的新学。
  拓扑结构:
  1、PC1在VLAN 10中,IP地址是192.168.10.0/24
  2、PC2在VLAN20中,IP地址是192.168.20.0/24
  3、路由器在VLAN30中,IP地址是192.168.30.0/24
  4、中间的交换机为三层交换或者是路由器(不需要VLAN)。
   配置关键点:
  1、三层交换机的VLAN10 VLAN20 VLAN30虚接口要起PROXY-ARP协议(CISCO默认是开启的此处采用的是CISCO设备,因此配置中体现不出来)。相关配置如下:
           
  1. !
  2.     interface FastEthernet3/0
  3.     switchport access vlan 10
  4.     !
  5.     interface FastEthernet3/1
  6.     switchport access vlan 20
  7.     !
  8.     interface FastEthernet3/2
  9.     switchport access vlan 30
  10.     !
  11.     interface Vlan10
  12.     ip address 192.168.10.1 255.255.255.0
  13.     !
  14.     interface Vlan20
  15.     ip address 192.168.20.1 255.255.255.0
  16.     !
  17.     interface Vlan30
  18.     ip address 192.168.30.1 255.255.255.0
  19.    
复制代码
           
  2、下面PC机的网关可以设置为自身也可以设置为VLAN虚接口的网关。
  3、出口路由器的内网IP地址掩码要变小(只要能够包含内网的相关网段即可),此处为了方便选用了16bit,IP地址是192.168.30.2/16,无需添加任何静态路由。
  相关配置如下:


           
  1. interface FastEthernet2/0
  2.     ip address 192.168.30.2 255.255.0.0
  3.     duplex auto
  4.     speed auto

  5.     R3# show ip route
  6.     Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
  7.         D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  8.         N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  9.         E1 - OSPF external type 1, E2 - OSPF external type 2
  10.         i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
  11.         ia - IS-IS inter area, * - candidate default, U - per-user static route
  12.         o - ODR, P - periodic downloaded static route

  13.     Gateway of last resort is not set

  14.     C? ? 192.168.0.0/16 is directly connected, FastEthernet2/0
  15.     R3#

复制代码
           



  四、测试结果如下:
           
  1. R3#ping 192.168.10.2

  2.     Type escape sequence to abort.
  3.     Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
  4.     !!!!!
  5.     Success rate is 100 percent (5/5), round-trip min/avg/max = 20/72/120 ms
  6.     R3#ping 192.168.20.2

  7.     Type escape sequence to abort.
  8.     Sending 5, 100-byte ICMP Echos to 192.168.20.2, timeout is 2 seconds:
  9.     !!!!!
  10.     Success rate is 100 percent (5/5), round-trip min/avg/max = 60/76/116 ms

复制代码
           








欢迎光临 DIY编程器网 (http://diybcq.com/) Powered by Discuz! X3.2