网友提出的问题:有6个小区的监控,分别处于不同的网段,例如:小区1是192.168.1.*,小区2是192.168.2.*,……,小区6是192.168.6.*,我现在通过每个小区监控的汇聚交换机的一个端口,用6对光纤收发器把6个小区监控汇聚到了一台交换机(3层),现在有一台网关服务器,只能接受一个网段,现在如何通过3层交换机,把6个不同网段路由成一个网段,输出给网关交换机?
一、配置思路:
1、将小区1、2、3、4、5、6的摄像头连接到小区接入交换机的接口分别划分到vlan10、vlan20、vlan30、vlan40、vlan50、vlan60。
小区接入交换机分别划分对应小区的vlan。如:LSW1上建立vlan10,LSW2上建立vlan20。。。在核心交换机Core1上,创建vlan10、20、30、40、50、60、100。Vlan100是上连AR1路由器的vlan。创建上连路由器的IP地址:vlanif100:192.168.100.254/24;下连小区1接入交换机vlanif10:192.168.1.254/24;下连小区2接入交换机vlanif20:192.168.2.254/24;下连小区3接入交换机vlanif30:192.168.3.254/24;下连小区4接入交换机vlanif40:192.168.4.254/24;下连小区5接入交换机vlanif50:192.168.5.254/24;下连小区6接入交换机vlanif60:192.168.6.254/24;
2、在AR1的GE0/0/0接口配置地址:192.168.100.253/24
3、在AR1的Loopback0接口配置地址:172.16.1.1/24,这主要是模拟路由器连接的其他网络,可以配置,也可以不配置。
4、在Core1上配置默认静态路由,在AR1上配置到各小区网络的静态路由。
二、小区1接入交换机LSW1的主要配置文件:
disp cu
#
sysname LSW1
#
vlan batch 10
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10
#
Return
三、小区2接入交换机LSW2的主要配置文件:
#
sysname LSW2
#
vlan batch 20
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
其他小区的接入交换机配置是一致,这里不再赘述。
四、核心交换机Core1的主要配置文件:
#
sysname Core1
#
vlan batch 10 20 30 40 50 60 100
#
interface Vlanif10
ip address 192.168.1.254 255.255.255.0
#
interface Vlanif20
ip address 192.168.2.254 255.255.255.0
#
interface Vlanif30
ip address 192.168.3.254 255.255.255.0
#
interface Vlanif40
ip address 192.168.4.254 255.255.255.0
#
interface Vlanif50
ip address 192.168.5.254 255.255.255.0
#
interface Vlanif60
ip address 192.168.6.254 255.255.255.0
#
interface Vlanif100
ip address 192.168.100.254 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 30
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 40
#
interface GigabitEthernet0/0/5
port link-type trunk
port trunk allow-pass vlan 50
#
interface GigabitEthernet0/0/6
port link-type trunk
port trunk allow-pass vlan 60
#
interface GigabitEthernet0/0/7
port link-type access
port default vlan 100
#
ip route-static 0.0.0.0 0.0.0.0 192.168.100.253
#
return
五、AR1路由器的主要配置文件:
#
sysname AR1
#
interface GigabitEthernet0/0/0
ip address 192.168.100.253 255.255.255.0
#
interface LoopBack0
ip address 172.16.1.1 255.255.255.255 //模拟路由器连接其他路由器的网络
#
ip route-static 192.168.1.0 255.255.255.0 192.168.100.254
ip route-static 192.168.2.0 255.255.255.0 192.168.100.254
ip route-static 192.168.3.0 255.255.255.0 192.168.100.254
ip route-static 192.168.4.0 255.255.255.0 192.168.100.254
ip route-static 192.168.5.0 255.255.255.0 192.168.100.254
ip route-static 192.168.6.0 255.255.255.0 192.168.100.254
#
return
六、检验结果:
1、小区1摄像头可以ping通路由器AR1
PC>ping 192.168.100.253
Ping 192.168.100.253: 32 data bytes, Press Ctrl_C to break
From 192.168.100.253: bytes=32 seq=1 ttl=254 time=156 ms
From 192.168.100.253: bytes=32 seq=2 ttl=254 time=78 ms
--- 192.168.100.253 ping statistics ---
2 packet(s) transmitted
2 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/117/156 ms
2、小区1摄像头可以ping通路由器AR1连接的其他网络(loopback0的地址)
PC>ping 172.16.1.1
Ping 172.16.1.1: 32 data bytes, Press Ctrl_C to break
From 172.16.1.1: bytes=32 seq=1 ttl=254 time=78 ms
From 172.16.1.1: bytes=32 seq=2 ttl=254 time=62 ms
From 172.16.1.1: bytes=32 seq=3 ttl=254 time=47 ms
From 172.16.1.1: bytes=32 seq=4 ttl=254 time=63 ms
From 172.16.1.1: bytes=32 seq=5 ttl=254 time=62 ms
--- 172.16.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/62/78 ms
领取专属 10元无门槛券
私享最新 技术干货