Do Command on CISCO Router/Switch

Other Cisco Other Cisco Material Original source

Command

Do

Use

Allows you to access privilege level commands while in configuration modes.

Syntax

Router(config)#do

Example

In the below example, the router’s IP information is verified while configuring OSPF

Copy

R2#conf t

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

R2(config)#router ospf 1

R2(config-router)#do sh ip int br | ex unass

Copy

Interface IP-Address OK? Method Status Protocol

FastEthernet1/0.24 150.1.24.2 YES NVRAM up up

FastEthernet1/0.42 150.1.42.2 YES NVRAM up up

Loopback0 200.0.0.1 YES NVRAM up up

Loopback24 150.1.124.2 YES NVRAM up up

Loopback42 150.1.142.2 YES NVRAM up up

Copy

R2(config-router)#

R2(config-router)#network 150.1.24.2 0.0.0.0 area 24

R2(config-router)#do sh ip route

Copy

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



200.0.0.0/32 is subnetted, 1 subnets

C 200.0.0.1 is directly connected, Loopback0

Instead of using the do command, we would have had to do the following.

Copy

R2#conf t

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

R2(config)#router ospf 1

R2(config-router)#end

R2#

R2#sh ip int br | ex unass

Copy

Interface IP-Address OK? Method Status Protocol

FastEthernet1/0.24 150.1.24.2 YES NVRAM up up

FastEthernet1/0.42 150.1.42.2 YES NVRAM up up

Loopback0 200.0.0.1 YES NVRAM up up

Loopback24 150.1.124.2 YES NVRAM up up

Loopback42 150.1.142.2 YES NVRAM up up

Copy

R2#conf t

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

R2(config)#router ospf 1

R2(config-router)#network 150.1.24.2 0.0.0.0 area 24

Obviously this is not the most efficient method. The Do command will become one of your most used and valued command!!!

← All Other Cisco articles Home