分享
 
 
 

ip route 0.0.0.0 0.0.0.0和ip defult-network区别

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

哪位能说说ip route 0.0.0.0 0.0.0.0和ip default-network命令的区别吗?

我所知道的ip route 命令会向路由表里加一条静态路由,ip default-network命令不会

ip route 命令按接口和地址指定缺省路由ip default-network命令按网络指定

谁能说说还有什么区别?以及在什么情况下使用哪条吗?还有他们在再发布时的区别!

FW:发信人: canway()

整理人: sanjose(2000-09-26 10:54:44), 站内信件

Q:

听了各位解释,有些明白,可是路由器没有路由还叫路由器吗,那样两个命令

功能似乎是一样的,都是把不知道到的包发给下一个站点,可是我在做一个项目

时,

设置ip default-gateway就不行。用ip route 0.0.0.0 0.0.0.0 xxxxxxxx

就通了。 是不是这样,对于ip default-gateway来说,只有对这个网段才有效,

而从其他

网段路由过来的其他网段的信息到了用ip default-gateway的网段就不能利用这

个 命令传送,而是要用ip route 0.0.0.0 0.0.0.0.了。也就是ip route 0.0.0

.0

0.0.0.0才能完成路由功能,不知道理解的对吗

Answer:

1。 ip default-gateway用与路由器不作路由时使用,这时路由器就只是一台主

机好象Win95PC一样需要配一个网关才能与外界通信。

假如 “no ip routing"则路由器就不作路由。这时你可以配bridge-group,把路

由表及里器当switch使。

2。 ip route 0.0.0.0 0.0.0.0 用于履行路由功能。假如ip routin

g是enable的则ip default-gateway不起作用.

FW:区别在于,ip route本机生效,ip default-network可以影响整个路由协议域

http://www.cisco.com/en/US/customer...sHtml#ipnetwork

FW:IntrodUCtion

This Tech Note eXPlains how to configure a default route, or gateway of last resort, using the following IP commands: ip default-gateway, ip default-network, and ip route 0.0.0.0 0.0.0.0. Let's look at each of these commands in more detail.

Before You Begin

Conventions

For more information on document conventions, see the Cisco Technical Tips Conventions.

Prerequisites

There are no specific prerequisites for this document.

Components Used

This document is not restricted to specific software and hardware versions.

The information presented in this document was created from devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If you are working in a live network, ensure that you understand the potential impact of any command before using it.

ip default-gateway

The ip default-gateway command differs from the other two commands in that 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 doesn't have ip routing enabled.

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. Let's look at the following routing table taken from a Cisco router:

2513#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is not set

161.44.0.0 255.255.255.0 is subnetted, 1 subnets

C 161.44.192.0 is directly connected, Ethernet0

S 198.10.1.0 [1/0] via 161.44.192.2

131.108.0.0 255.255.255.0 is subnetted, 1 subnets

C 131.108.99.0 is directly connected, TokenRing0

Note the static route to 198.10.1.0 via 161.44.192.2 and that the gateway of last resort isn't set. If we configure ip default-network 198.10.1.0, the routing table changes to the following:

2513#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is 161.44.192.2 to network 198.10.1.0

161.44.0.0 255.255.255.0 is subnetted, 1 subnets

C 161.44.192.0 is directly connected, Ethernet0

S 161.44.0.0 255.255.0.0 [1/0] via 161.44.192.0

S* 198.10.1.0 [1/0] via 161.44.192.2

131.108.0.0 255.255.255.0 is subnetted, 1 subnets

C 131.108.99.0 is directly connected, TokenRing0

2513#show ip protocols

2513#

We can see the gateway of last resort has now been set as 161.44.192.2. This result is independent of any routing protocol, as shown by the show ip protocols command at the bottom of the output.

We can add another candidate default route simply by configuring another instance of ip default-network:

2513#config terminal

Enter configuration commands, one per line. End with CNTL/Z.

2513(config)#ip route 171.70.24.0 255.255.255.0 131.108.99.2

2513(config)#ip default-network 171.70.24.0

2513(config)#^Z

2513#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is 161.44.192.2 to network 198.10.1.0

161.44.0.0 255.255.255.0 is subnetted, 1 subnets

C 161.44.192.0 is directly connected, Ethernet0

S 161.44.0.0 255.255.0.0 [1/0] via 161.44.192.0

S* 198.10.1.0 [1/0] via 161.44.192.2

171.70.0.0 is variably subnetted, 2 subnets, 2 masks

S 171.70.0.0 255.255.0.0 [1/0] via 171.70.24.0

S 171.70.24.0 255.255.255.0 [1/0] via 131.108.99.2

131.108.0.0 255.255.255.0 is subnetted, 1 subnets

C 131.108.99.0 is directly connected, TokenRing0

Flagging a Default Network

Note: The ip default-network command is classful, which means 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.

2513#config terminal

Enter configuration commands, one per line. End with CNTL/Z.

2513(config)#ip default-network 171.70.0.0

2513(config)#^Z

2513#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is 161.44.192.2 to network 198.10.1.0

161.44.0.0 255.255.255.0 is subnetted, 1 subnets

C 161.44.192.0 is directly connected, Ethernet0

S 161.44.0.0 255.255.0.0 [1/0] via 161.44.192.0

S* 198.10.1.0 [1/0] via 161.44.192.2

171.70.0.0 is variab

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有