路由器常用配置命令

来源:互联网 发布:c语言求平方根的算法 编辑:程序博客网 时间:2024/06/05 15:22

配置路由器的方法:Console 端口配置、Telnet远程登录配置。

路由器配置模式。

1. 用户模式。Router>

2. 特权模式。Router>#  。用户模式下输入enable即可。

3. 全局配置模式。Routerconfig。特权模式下输入 configure terminal即可。

3.1 Routerconfig-if#         接口配置

3.2 Routerconfig-line#       线路配置

3.3 Routerconfig-router#     路由配置

在任何一种模式下,用“exit”返回到上一级模式;用“end”直接返回到特权模式。

 一些简单命令示例。仿真软件:Cisco Packet Tracer。

Router>

Router>enable 

Router#configure terminal 

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

Router(config)#interface fastEthernet 0/1

Router(config-if)#ip address 192.168.1.1 255.255.255.0

Router(config-if)#no shutdown 

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Router(config-if)#exit

Router(config)#hostname cc_router

cc_router(config)#exit

cc_router#

%SYS-5-CONFIG_I: Configured from console by console

cc_router#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

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       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, 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.1.0/24 is directly connected, FastEthernet0/1

cc_router#

-------------------------------------------------------------------------------------------------------------------------------------------

 保存设置

对于配置文件来说,参数值run表示存放在DRAM中的配置。start表示存放在NVRAM中的配置。所有的配置命令只要键入后马上存在DRAM并运行,但掉电后会马上丢失。而NVRAM中配置只有在重新启动之后才会被复制到DRAM中运行,掉电后不会丢失,因此,必须养成好的配置习惯。在确认配置正确无误后将配置文件复制到NVRAM中去。其命令为
copy run start

ip access-group 命令将已定义的access-list用在某一个接口的in或则out方向。

 

2 0
原创粉丝点击