Static and Default Route Command List


Static and Default Route Command List

Most networks will use one (or more) routing protocols to automatically share and learn routes. Listed below are several situations when you might want to configure static routes.

  • To configure a default route or a route out of a stub network (a stub network is one that has a single route into and out of the network).
  • For small networks that do not change very often and that have only a few networks.
  • To turn off all routing protocols and reduce traffic or improve security.
  • To configure routes that are lost due to route summarization.

A default route is a route that is considered to match all destination IP addresses. With a default route, when a packet's destination IP address does not match any other routes, the router uses the default route for forwarding the packet. Be aware of the following default route details:

  • Default routes work best when only one path exists to a part of the network.
  • One default route in the routing table could replace hundreds of static route entries in the routing table.
  • When the default route is not set, the router discards packets that do not match a route in the routing table.

The following table lists the commands for configuring static routes:

Use . . .

To . . .

Router(config)#ip route <destination> <next_hop>

Identify a next hop router to receive packets sent to the specified destination network.

Router(config)#ip route <destination> <interface>

Identify the interface used to forward packets to the specified destination network.

Router(config)#ip route 0.0.0.0 0.0.0.0 <next hop or interface>

Identify a default route to the specified destination network or through an interface. This is a method to set the gateway of last resort on a router.

Router(config)#ip classless

Enables the router to match routes based on the number of bits in the mask and not the default subnet mask.

Router#show ip route

View the routing table.

Router#show ip route <hostname or address>

View details about the specific route.

Note: Configuring a static route to network 0.0.0.0 with mask of 0.0.0.0 is the most common method of configuring a default gateway. However, the following methods can also be used under certain circumstances:

  • Use the ip default-network command to designate a route already in the routing table as the default route. For example, if the router had learned of network 10.0.0.0/8 through a routing protocol, you could use the following command to designate that network as the default network:
    ip default-network 10.0.0.0
    Be aware that the ip default-network command only makes a route a candidate for the default route, it does not necessarily guarantee that the route will be used to route packets to unknown destinations.
  • Use the ip default-gateway command if IP routing has been disabled on the router. With IP routing disabled, routes will not be learned through a routing protocol, nor will static routes be used if configured. With IP routing enabled, the ip default-gateway setting will not be used.

Examples
The following command creates a static route to network 192.168.1.0 through the router with the IP address 192.168.1.35 and gives it an administrative distance value of 25.

Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.1.35 25

The following command identifies a default route through an interface with address 10.1.1.2.

Router(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2

 

 

 

 

Credit: Testout 640-802 CCNA Notes

หมายเลขบันทึก: 316623เขียนเมื่อ 27 พฤศจิกายน 2009 22:40 น. ()แก้ไขเมื่อ 15 มิถุนายน 2012 19:03 น. ()สัญญาอนุญาต: ครีเอทีฟคอมมอนส์แบบ แสดงที่มา-ไม่ใช้เพื่อการค้า-อนุญาตแบบเดียวกันจำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (0)

ไม่มีความเห็น

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท