static routing setting examples to
with the popularity of broadband access, many families and small businesses have set up the LAN to share broadband access.And with the expansion of local area network (LAN), a lot of places are involved in the application of two or more routers.When a router exist more than two (2) of the wlan, due to its host visits needs, often need to set up routing.Because the network is smaller and does not change often, so the static routing is the most appropriate choice.This article as a junior into the category of article
, with a few simple examples explain static routing, and at the last explain a little about routing summary (inductive).Because this kind of home and small office LAN broadband router is generally adopted by the perfection, so this article is the simplest broadband router, for example.(in fact, no matter in what class on a router, in addition to the different configuration mode and command, the configuration principle of the static routing is not distinct.)Common 1, 4 LAN broadband router WAN port may be regarded as one of the most simple double Ethernet router + a 4 separate switch, the WAN port connect outside network, LAN port pick up Intranet for distinction.
routing is to transmit the information from a source to a destination.Image, the packet is compared to a man who wants to go to a place, the routing is the process of selecting the path to the people.And routing table like a map, marked with the various route, the packet will depend on the route guidance to reach the destination routing table, routing entries are like road signs.In most broadband router is not configured under the condition of static routing, inside there is a default route, the route will be a LAN mouth under all destinations are not within their local area network packet forwarding to the gateway to the WAN port.Broadband router only requires the WAN port parameters of simple configuration, network can access the network host, this is the routing at work.This paper will be in two parts, the first part explain the static routing the setup of the application, the second part explain about routing inductive method and effect.Below
on sweet potato several typical beginners in the web application, for example, let master prawn to explain what you need to set up the static routing, the composition of static route entries, and the concrete effect of the static routing.A:
cases of simple string type double router
this kind of situation in the environment of small and medium-sized enterprises (smes) in the original router sharing Internet network, as a result of the need of extension, to access a router to connect to another new network segment.In families are likely to appear this kind of circumstance, such as Shared broadband with a broadband router, and added a wireless router wireless access to the client.
sweet potato: 1, the original a LAN LAN in the company by sharing the Internet, a router is now add another router, hang another network segment to 2 LAN hosts.After simple Settings, found all hosts share the Internet there is no problem, but the host LAN 1 can't communicate with LAN 2 host, but 2 host LAN Ping LAN host 1.This is how to return a responsibility?
big shrimp: that's because the router from radio, divides the broadcast domain, and LAN LAN 1 2 at this time of the host in the two different network segments, was isolated from the new router in the middle.So LAN 1 at this time of the host can't "See "To the host in the LAN 1, only packets sent to the default gateway, and the gateway is not set to LAN 2 routing, unable to do effective forward.In this case, the static route entries must be set.
LAN 1 as the 192.168.0.0 the standard class C network segment, the router R1 for original router, it WAN port broadband access, LAN mouth hanging (IP 192.168.0.1) 192.168.0.0 network segment (class C network subnet mask 255.255.255.0) host and router R2 (new) WAN port for 192.168.0.100 (IP).R2 LAN port (IP 192.168.1.1) hung under the new LAN 2 the 192.168.1.0 class C of different hosts.www.jb51.net
if simple Settings, according to the sharing of the Internet way at this time should be 192.168.0.0 mainframe gateway is refers to the LAN port (192.168.0.1) R1, 192.168.1.0 network segment of the mainframe gateway to R2 LAN (192.168.1.1), so as long as the WAN port gateway to 192.168.0.1 R2, 192.168.1.0 host can access 192.168.0.0 network segment of the host and can surf the Internet through a broadband connection.This is because the above one broadband router default routes at work, it will be all the IP packet is sent to the purpose of this section of the WAN port gateway (that is, the router R1), and then determined by R1 packets should be forwarded to the even its own network or to the network.But 192.168.0.0 network segment of the mainframe gateway must point to 192.168.0.1, and R1 at this time is not the correct position of the LAN 2 know 192.168.1.0, so at this time can only surf the Internet and visits, within this period can not access to the 192.168.1.0 network segment of the host.Then you need to specify a static route on R1, the destination IP to 192.168.1.0 network packets can be forwarded to the router R2.
a static route entry generally consists of three parts: 1. The destination IP address or call obtaining-information network, subnet,2. The subnet mask.3. The gateway or call the next jump.
cases of one set of static route entries on R1 should be as follows: the destination IP address 192.168.1.0 (on behalf of 1 x this segment), subnet mask 255.255.255.0 (because of type C segment), the next-hop 192.168.0.100.As shown in figure 2, the static routing tables in the graph is TP R410 cc-link configuration items, take effect after save.If it is a Cisco Router, then type the command in global configuration mode: the Router (config) # IP route 192.168.1.0 255.255.255.0 192.168.0.100.
note: including the gateway IP must be belong to the same network segment to a WAN or LAN port.The default route is written: 0.0.0.0 destination IP, subnet mask 0.0.0.0, next jump for the default gateway on the WAN port, sometimes we call it "Throughout the default routing & 8 0;.In addition, if the destination IP is a specific host IP (e.g., 192.168.1.2 instead), so the routing entry should be: destination IP 192.168.1.2 instead, subnet mask 255.255.255.255, 192.168.0.100 next jump or gateway.
using this connection, can also be convenient to use the router built-in access control list to set up the LAN host under 2 access, this is very convenient for enterprise users.The broadband router "Firewall Settings "Is actually a simplified Access Control list, namely the ACL - Access Control Lists.Such as: hope LAN LAN IP address is in 2 192.168.1.7 computer can't send and receive mail, the IP address for 192.168.1.8 computer cannot access server of ERP in enterprise internal LAN 1 (assuming the IP for 192.168.0.10), to the other computer does not do any limitation of local area network (LAN), then you need to specify the following packet filtering tables.
cases of 2: two peers, and even the router, hanging in the host need to communicate with each other under the environment of
in this case, two parallel and even the router upper still should have a general export gateway, the gateway may be inconvenient for some reason set routing, and at this point in the network there are three different network segment.
sweet potato: my home is in sharing community broadband access, myself with a broadband router to build a home network with Internet, sharing neighbors were just like me with constructed another family LAN broadband router.And our respective does not communicate with each other between hosts in a network, it simply can't, this is how to return a responsibility?
big shrimp: in this case the whole village is a large local area network (LAN), the host can't each other, but with a medium can't ping LAN LAN 1 2 for the same reasons, all because of the upper segment of the default gateway does not know the destination IP belong to the right place, can't do effective forward.
network gateway is the gateway, with two home broadband router R1 and R3, usually by floor access switches between them and the backbone of the switches to the community together, this figure this part is omitted.Figure 4 this kind of situation, as long as the gateway device well-founded sex-discrimination A way to add two routing can achieve two visits, the host and the 10.0.0.0 this class A network segment that exist in the host can be accessed through the two routing in the Intranet machine under the R1 and R3.But if it is a residential gateway equipment, it must be won't let the user to configure routing entry, and you should also don't want to all users in the community can direct access to your Intranet hosts.At this time, we can in the add a route on R1 and R3 to each other to achieve R1 and R3 host directly under the effect of the exchange of visits.
on the R1: along the destination IP address, subnet mask 255.255.0.0 (class B segment), the next-hop 10.1.1.3.
on R3:192.168.0.0 destination IP address, subnet mask 255.255.255.0 (class C network segment), the next-hop 10.1.1.2.
note: some use P - VLAN technology in the new community, the network situation is more complex, so the simple static routing Settings may not be able to achieve a goal.Three:
cases of both series and, in the network have multiple routing equipment environment.
this kind of situation can be said to be the case 1 and 2 of the integration of two kinds of application and extension, seemingly complex are simple.
sweet potato: if like cases 2 environment, local area network (LAN) in my family to acquire a router, the extension, hang another network segment to do and how to set?
big shrimp: you say this kind of network structure, really is the case and case becoming together.So there are now four segments, we set up is to let the two families of local area net three subnet host can exchange, while the area of the gateway or not set, of course.
you can see in figure 5 is integrated with figure 1 and figure 4.Since the topology is patients, the combination of the two, it will case, two cases of routing entry together is it ok?It is certainly not so simple, if just configured routing entry in the first two cases, the host under R3 is unable to access directly to the R2 192.168.1.0 under the subnet.So on R3 to impose the routing of a to the 192.168.1.0 the subnet.Static routing entry configuration is as follows:
r1:192.168.1.0 destination IP address, subnet mask 255.255.255.0, the next-hop 192.168.0.100.
along the destination IP address, subnet mask 255.255.0.0, the next-hop 10.1.1.3.R3:
192.168.0.0 destination IP address, subnet mask 255.255.255.0, the next-hop 10.1.1.2.
192.168.1.0 destination IP address, subnet mask 255.255.255.0, the next-hop 10.1.1.2.
sweet potato: why the next-hop routing in 2 in R3 is not directly point to R2, but also points to the R1?Big shrimp:
knew you would ask this, this problem will come from the principle of communication between routers.Router is through ARP resolution protocol to get the next-hop router's MAC address, and ARP based on the radio, in the general case the router will not forward broadcasts, also is unable to broadcast packets passing by.So for router R3, R1 and R3 is the same level, it can only see R1, cannot see R2, which is why referred to in the cases of a note: "The gateway IP must be belong to the same network segment to a WAN or LAN port "The reason why.And the article of static route entries in part 3: gateway, also called the next jump, and not let down two jump, triple jump is also one of the means.In short, in general, the next-hop router's IP address must be with this router is an interface in the same network segment.