cisco add static routes

Static Routing: by the people, to write the manual route entry is called static routing, permanent, highest priority, highest efficiency.

The router is doing?

Connecting networks of different address segment. Webcast shield of different addresses.

Routers have multiple interfaces, you must have at least two bars, one on each side LAN.

  • Query routing table entries routingshow ip route

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    Gateway of last resort is not set
    C    192.168.0.0/24 is directly connected, FastEthernet1/0

    C: represents the direct meaning. That I use 1/0 interfaces, can be connected to any host on the network 192.168.0.0/24.

  • Not exit global mode, execute commands in privileged mode in global mode: plus do in front of the commands in the original privileged mode

    R2(config)#do show ip interface brief
    Interface                  IP-Address      OK? Method Status                Protocol
    FastEthernet0/0            192.168.0.2     YES manual up                    up  
    FastEthernet1/0            unassigned      YES unset  administratively down down
    R2(config)#
  • China Unicom to test whether two points: ping

    R1#ping 192.168.0.2
    
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
    .!!!!
    Success rate is 80 percent (4/5), round-trip min/avg/max = 60/61/64 ms
    R1#ping 192.168.0.2

    The results in the [.] !!!! meanings:! On behalf pass; representative unreasonable. As long as one! , It shows through. As for why there is the first point, the reason is because of ARP.

  • Suppose ip address router has two interfaces, interfaces f0 / 0 are: 192.168.0.1/24, ip address can then no further interface f1 / 0, and an interface configured to f0 / 0 is the same network segment address ip , and will report the following error: [% 192.168.0.0 overlaps with FastEthernet0 / 0].

    The router is connected to different network addresses born, two interface settings become the same address range, it becomes switch (SWITH) a. It would be better directly with the switch. Much cheaper than the switch router.

    R2(config)#do show ip interface brief
    Interface                  IP-Address      OK? Method Status                Protocol
    FastEthernet0/0            192.168.0.2     YES manual up                    up  
    FastEthernet1/0            unassigned      YES unset  administratively down down
    R2(config)#interface f1/0
    R2(config-if)#ip addres 192.168.0.3 255.255.255.0
    % 192.168.0.0 overlaps with FastEthernet0/0

    This shows that the router is connected to a different LAN, and the LAN 2 isolate broadcast.

  • Protocol ping uses ICMP. ICMP protocol is a network layer protocol.

    From an interface f0 / 0 A is a router, the address of a scene are not directly connected to another router B's ping f1 / 0, which two network interfaces are in different segments:

    To use the ICMP protocol ping, ICMP packet protocol's requirements active IP address and destination IP address and, unable to know (in the router A router B routing table is not in f1 / 0 entry segment) interfaces through which they go out, We can not know the source IP address, so the ICMP protocol packets can not be made, of course, will not be able to send, so the ping fails.

    ping, but also must be able to go back to the ping.

Add routing entries

1, do not specify an interface that is not specified source IP, routers need to go to a recursive query, in order to obtain a source interface ip:ip route 192.168.1.0 255.255.255.0 192.168.0.2

192.168.1.0 255.255.255.0: is the target network

192.168.0.2: is the next hop.

In order to be able to access 192.168.1.0 255.255.255.0 network, you must use 192.168.0.2, as a springboard.

R1(config)#ip route 192.168.1.0 255.255.255.0 192.168.0.2
R1(config)#do show ip route
Gateway of last resort is not set
C    192.168.0.0/24 is directly connected, FastEthernet1/0
S    192.168.1.0/24 [1/0] via 192.168.0.2

S: represents the static routing means.

Method 2, the next hop is not specified, but the specified interface. No next hop routing addressing slow:ip route 192.168.1.0 255.255.255.0 f1/0

R1(config)#ip route  192.168.1.0 255.255.255.0 f1/0
R1#show ip route
C    192.168.0.0/24 is directly connected, FastEthernet1/0
S    192.168.1.0/24 is directly connected, FastEthernet1/0

Method 3, both the interface and to specify the next hop:ip route 192.168.1.0 255.255.255.0 f1/0 192.168.0.2

R1(config)#ip route 192.168.1.0 255.255.255.0 f1/0 192.168.0.2
R1(config)#do show ip route
C    192.168.0.0/24 is directly connected, FastEthernet1/0
S    192.168.1.0/24 [1/0] via 192.168.0.2, FastEthernet1/0

In this way the best

Stub network: only through a next hop to all networks.

For example company, which hosts are private ip, the company has only one public network ip, so it is necessary to specify the next hop router to the public network ip.

S    0.0.0.0/0 [1/0] via 公网ip, FastEthernet1/0

Load balancing routing entries:

The destination is the same, there are many paths to reach the destination, in order to avoid a congestion too several routes, on the use of load-balancing routing entry, the request is assigned to each average route.

S    0.0.0.0/0 [1/0] via 192.168.0.2,192.168.1.2,192.168.2.2 ...

Mask the longest match

When there is more than one route entries can reach the destination, choose that route it?

Choose the longest mask.

For example: the destination is 192.168.2.1, there are two entries in the routing, as shown below. This can be reached by two, but the choices are S 192.168.2.1 / 32. It is because the length of the mask 32, 24 is the other.

S 192.168.2.1 /32 via ...
S 192.168.2.0 /24 via ... 

For example: When accessing 12.2.0.0, 12.1.1.0 / 24 and 12.1.1.0/24 does not match, only match 12.0.0.0/8

12.1.1.1/32
12.1.1.0/24
12.0.0.0/8

Static routing advantages and disadvantages:

c / c ++ mutual learning QQ group: 877 684 253

I micro letter: xiaoshitou5854

Guess you like

Origin www.cnblogs.com/xiaoshiwang/p/12177598.html