Using the Soho router to implement a port-based VLAN Communication _ switch for Layer two switches

Source: Internet
Author: User
Tags switches
1. Background

Generally implement VLAN communication, or use a three-tier switch, or a single arm routing, both of which are very expensive, so when there is the need for VLAN communication, and the data volume of the VLAN communication is not very large, with 50 of Soho route to build a network is very affordable.

My original demand is this:
With an n-port two-layer switch, you need to do a test case for it, and the core of the test cases is the need for an Ethernet packet to pass through all of its n ports.
In order to achieve this goal, the N-Port 22 will be divided into a VLAN, respectively, vlan0,vlan1,vlan2 ..., the neighboring VLAN can communicate, so the data can go like this: VLAN0 's port1->vlan0 port2-> The Port2...->vlann of the Port1->vlann Port2 of the port1->vlan2 of the VLAN1 's Port1->vlan1 port2->vlan2.

PS. The Soho route used here must support the static routing table. 2. Principle

First of all, before I think about this issue, I see someone else's switch to achieve VLAN communication, just use a crossover network to connect the different VLAN, and then I was very naïve to go back and try so, the result is very hurt. This is one of the things that I have never been able to solve, and the VLAN itself has any meaning if it can be communicated with a crossover cable.

Pulled away.

First, switch.
A port-based VLAN typically works like this, and when a switch receives an Ethernet frame, it marks the Ethernet frame, where the tag information contains which port the Ethernet frame is received, and if the VLAN is set, The switch then forwards the packet Ethernet frame to a specific port (the same VLAN's port) based on the VLAN configuration and the port information inside the tag.

Again Soho router.
Why is Soho router qualified for this job? First, the SOHO router will have two ports, a LAN port and a WAN port. To communicate between VLANs, you must come to the third level of the Protocol. LAN Port and WAN port communication between the NAT protocol, such as LAN port IP address is the IP address of the 192.168.1.123,wan port is 10.10.11.1,192.168.1.123 to ping 10.10.11.1 is able to ping successfully, Because the Soho route has done the NAT transformation inside. So, the basic idea is that a VLAN to the LAN port, a VLAN to the WAN port, so that the two VLAN can communicate, and the VLAN generated broadcast storms will not affect other VLANs.

So the question is, if it's a lot of VLAN to communicate, how to build.
This is the time to use the static routing table of Soho routing. The basic idea is this: if the Router 1 WAN port and Router 2 LAN network connection, then the two ports in a LAN, then as long as the IP address of the WAN and LAN IP address in the same network segment, then they can communicate, And the LAN port of Router 2 can communicate with Router 2 WAN port through NAT, so the WAN of Router 1 can also communicate with Router 2 WAN port, then cascade down in this way, then the Cross VLAN communication can be realized, so I have the following topology:

In this topology, PC1 and PC2 are two machines that are in different VLANs and need to communicate with each other. For this switch, Port1 and Port2 are a vlan,port3 and Port4 is a vlan,port5 and port6 is a VLAN ..., and so on, altogether divides 6 VLANs. 3. Configure

Set up the above topology map, but also need to do a job, that is, setting up all the routers static routing table.

An entry for a static routing table has 3 parts:
1) Destination network address
2) Subnet Mask
3) Gateway
So the function of the static routing table is to forward the packet of the destination network address to the gateway address.

So, according to the topology above, PC1 to ping 10.30.11.1 this address, add a static route entry on Router 1:
Destination network address: 10.30.11.0
Subnet Mask: 255.255.255.0
Gateway: 10.20.11.2

In this way, all packets with the destination IP 10.30.11.0~10.30.11.255 will be forwarded to the 10.20.11.2, and then through Router 2 NAT, The data can reach 10.30.11.1, by which the static routing table for all routes above is added:
4. One more thing to be aware of

Follow the steps above, you will find that sometimes PC1 and PC2 still cannot ping each other, this is because the computer has more than two network cards, so the routing table will also be changed:
1) PC1 Run "cmd.exe", win7 the above system to run the administrator rights.
2) Input:
Route Delete 0.0.0.0
Route add 0.0.0.0 Mask 0.0.0.0 10.10.11.1-p
As with adding static route entries, this means that all packets are forwarded to the 10.10.11.1 address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.