Configuring a Gateway of Last Resort Using IP Commands
来源:互联网 发布:机械制作软件 编辑:程序博客网 时间:2024/04/30 01:59
The ip default-gateway command differs from the other two commands. It should only be used when ip routing is disabled on the Cisco router.
For instance, if the router is a host in the IP world, you can use this command to define a default gateway for it. You might also use this command when your low end Cisco router is in boot mode in order to TFTP a Cisco IOS® Software image to the router. In boot mode, the router does not have ip routing enabled.
This example defines the router on IP address 172.16.15.4 as the default route:
ip default-gateway 172.16.15.4
这个命令主要用在终端不够时,或者不启用ip routing功能时,设置默认网关。以此来保证end device可以访问外网。
ip default-network
Unlike the ip default-gateway command, you can use ip default-network when ip routing is enabled on the Cisco router. When you configure ip default-network the router considers routes to that network for installation as the gateway of last resort on the router.
For every network configured with ip default-network, if a router has a route to that network, that route is flagged as a candidate default route.
Flag a Default Network
Note: The ip default-network command is classful. This means that if the router has a route to the subnet indicated by this command, it installs the route to the major net. At this point neither network has been flagged as the default network. The ip default-network command must be issued again, using the major net, in order to flag the candidate default route.
There are still no IP protocols running here. Without any dynamic protocols running, you can configure your router to choose from a number of candidate default routes based on whether the routing table has routes to networks other than 0.0.0.0/0. The ip default-network command allows you to configure robustness into the selection of a gateway of last resort. Rather than configuring static routes to specific next-hops, you can have the router choose a default route to a particular network by checking in the routing table.
If you lose the route to a particular network, the router selects the other candidate default。
ip route 0.0.0.0 0.0.0.0
Creating a static route to network 0.0.0.0 0.0.0.0 is another way to set the gateway of last resort on a router. As with the ip default-network command, using the static route to 0.0.0.0 is not dependent on any routing protocols. However, ip routing must be enabled on the router.
EIGRP propagates a route to network 0.0.0.0, but the static route must be redistributed into the routing protocol.
In earlier versions of RIP, the default route created using the ip route 0.0.0.0 0.0.0.0 was automatically advertised by RIP routers. In Cisco IOS Software Release 12.0T and later, RIP does not advertise the default route if the route is not learned via RIP. It may be necessary to redistribute the route into RIP.
The default routes created using the ip route 0.0.0.0 0.0.0.0 command are not propagated by OSPF and IS-IS. Additionally, this default cannot be redistributed into OSPF or IS-IS using the redistribute command. Use the default-information originate command to generate a default route into an IS-IS or OSPF routing domain.
Note: If you configure multiple networks as candidate default routes using the ip default-network command, the network that has the lowest administrative distance is chosen as the network for the gateway of last resort. If all the networks have the same administrative distance then the network listed first in the routing table (show ip route lists the routing table) is chosen as the network for the gateway of last resort. If you use both the ip default-network and ip route 0.0.0.0 0.0.0.0 commands to configure candidate default networks, and the network used by the ip default-network command is known statically, the network defined with the ip default-network command takes precedence and is chosen for the gateway of last resort. Otherwise if the network used by the ip default-network command is derived by a routing protocol, the ip route 0.0.0.0 0.0.0.0 command, which has a lower administrative distance, takes precedence and is chosen for the gateway of last resort. If you use multiple ip route 0.0.0.0 0.0.0.0 commands to configure a default route, traffic is load-balanced over the multiple routes.
Summary
Use the ip default-gateway command when ip routing is disabled on a Cisco router. Use the ip default-network and ip route 0.0.0.0 0.0.0.0 commands to set the gateway of last resort on Cisco routers that have ip routing enabled. The way in which routing protocols propagate the default route information varies for each protocol.
Document ID: 16448
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094374.shtml
- Configuring a Gateway of Last Resort Using IP Commands
- clear TCP/IP Gateway using WMI
- Kubernetes Configuration Configuring Redis using a ConfigMap
- A collection of Symfony commands
- Write a method to print the last K lines of an input file using C++
- Configurate a PowerHA | HACMP using commands line
- A categorized list of Windows CMD commands
- Configuring Linux / Raspberry Pi with a static IP address
- Configuring a Static IP address on your Raspberry Pi
- Get the IP address of a network interface in C using SIOCGIFADDR
- Configuring a New Product of Android 2.2 Froyo
- An A-Z Index of Windows PowerShell 2.0 commands
- Bash Commands - $? for testing the result of a command
- Using WinDbg - Advanced commands
- Using SVN Commands
- Detect ip of mac using nmap
- Set IP/Gateway/Dns
- 查看IP,DNS,GATEWAY
- ubuntu普通用户进入根目录的方法
- Java版中文转汉语拼音工具
- 英语
- cp 复制文件与文件夹
- JAVA功能代码《5》----将Java中的util.Date转换成sql.Date
- Configuring a Gateway of Last Resort Using IP Commands
- Xfire 图片(image) webservice byte 加密 传输 ---- 上传
- 【头脑风暴】产品流程图
- 挂载U盘
- 异常堆栈
- 将Apache作为LoadBalance前置机分别有三种不同的部署方式
- 关于c运行时库的互相排除 (转载)
- 注重实效的哲学
- Ubuntu下Objective-C开发环境搭建