配置路由命令汇总
- 格式:doc
- 大小:23.50 KB
- 文档页数:1
路由器配置命令大全路由器配置命令大全1.连接路由器1.1 使用串行控制台线连接路由器1.2 使用以太网接口连接路由器1.3 使用无线网络连接路由器2.基本配置2.1 配置主机名router(config)hostname [hostname]2.2 配置域名解析router(config)ip domn-name [domn-name] 2.3 配置密码router(config)enable secret [password] router(config)line console 0router(config-line)password [password] router(config-line)loginrouter(config-line)exitrouter(config)line vty 0 15router(config-line)password [password]router(config-line)loginrouter(config-line)exit2.4 配置管理IP地质router(config)interface [interface]router(config-if)ip address [ip-address] [subnet-mask]router(config-if)no shutdown3.网络协议配置3.1 配置静态路由router(config)ip route [destination-network] [subnet-mask] [next-hop]3.2 配置动态路由router(config)router [routing-protocol]router(config-router)network [network-address] [subnet-mask]3.3 配置带宽管理router(config)interface [interface]router(config-if)bandwidth [bandwidth-in-kbps]3.4 配置ACL(访问控制列表)router(config)access-list [access-list-number] [permit/deny] [source-network] [source-wildcard]4.NAT(网络地质转换)配置4.1 配置静态NATrouter(config)ip nat inside source static [inside-local-address] [outside-global-address]4.2 配置动态NATrouter(config)ip nat pool [pool-name] [start-ip-address] [end-ip-address] netmask [subnet-mask]router(config)ip nat inside source list [access-list] pool [pool-name]4.3 配置PAT(端口地质转换)router(config)interface [interface]router(config-if)ip nat insiderouter(config)interface [interface]router(config-if)ip nat outside5.VLAN(虚拟局域网)配置5.1 配置VLANrouter(config)vlan [vlan-id]router(config-vlan)name [vlan-name]5.2 配置接口VLANrouter(config)interface [interface]router(config-if)switchport mode accessrouter(config-if)switchport access vlan [vlan-id]5.3 配置Trunk接口router(config)interface [interface]router(config-if)switchport mode trunkrouter(config-if)switchport trunk allowed vlan [vlan-list]6.特定协议配置6.1 配置DHCP(动态主机配置协议)router(config)ip dhcp pool [pool-name]router(dhcp-config)network [network-address] [subnet-mask]router(dhcp-config)default-router [default-gateway]router(dhcp-config)dns-server [dns-server-ip]6.2 配置NTP(网络时间协议)router(config)ntp server [ntp-server-ip]router(config)ntp update-calendar6.3 配置SNMP(简单网络管理协议)router(config)snmp-server community [community-string] [ro/rw]router(config)snmp-server host [host-ip] [community-string]7.安全配置7.1 配置SSH(安全外壳协议)router(config)hostname [hostname]router(config)ip domn-name [domn-name]router(config)crypto key generate rsarouter(config)ip ssh version 2router(config)line vty 0 15router(config-line)transport input sshrouter(config-line)login localrouter(config-line)exit7.2 配置防火墙router(config)access-list [access-list-number] [permit/deny] [source-network] [source-wildcard] router(config)interface [interface]router(config-if)ip access-group [access-list-number] [in/out]附件:无法律名词及注释:- IP地质:Internet Protocol Address,互联网协议地质,用于标识网络上主机的唯一数字标识。
路由器的路由配置命令汇总(win和linux系统)2009-07-16 17:43:15分类:系统运维⼯作时总是要在这三个个体中配来配去,所以为了⽅便,汇总了。
win下:使⽤ Route 命令⾏⼯具查看并编辑计算机的 IP 路由表。
Route 命令和语法如下所⽰:route [-f] [-p] [Command][Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]-f 清除所有⽹关⼊⼝的路由表。
如果该参数与某个命令组合使⽤,路由表将在运⾏命令前清除。
-p 与 add 命令⼀起使⽤时使路由具有永久性。
该参数与 add 命令⼀起使⽤时,将使路由在系统引导程序之间持久存在。
默认情况下,系统重新启动时不保留路由。
与 print 命令⼀起使⽤时,显⽰已注册的持久路由列表。
忽略其他所有总是影响相应持久路由的命令。
Command 指定您想运⾏的命令 (Add/Change/Delete/Print)。
路由类型:有三种路由1.主机路由从⼀台主机映射⼀条到本地⽹络上的的其他主机上command format:route add -host destination_ip local_ip -interface interfaceeg:我们想为本地主机接⼝hme0(204.12.17.1)和另⼀台在相邻才C类⽹络上的主机(204.12.16.100)之间增加⼀条路由#route add -host 204.12.16.100 204.12.17.1 -interface hme02.⽹络路由允许数据包从本地主机传输到在本地⽹络的其他主机上增加⼀个到另⼀个⽹络的的直接路由command format:route add -net destination_network_ip local_ip -netmask maskeg:如果我们要想为C类⽹掩码在本地主机(204.12.17.1)和我们上⾯指出的⽹络之间增加⼀条路由(204.12.16.0⽹络)我们可以使⽤如下的命令:#route add -net 204.12.16.0 204.12.17.1 -netmask 255.255.255.03.缺省路由将寻找⼀条路由的任务传送到⼀台路由器。
基础命令练习1.模式Router> //用户模式Router# //特权模式(也叫enable 模式)Router(config-if)# //接口模式Router(config-router)# //router 模式Router(config-line)# //line 模式Router(config-subif)# //子接口模式2.模式切换Router> //用户模式Router>enable //在用户模式敲入enable 进入特权模式(也叫enable 模式)Router#disable //在特权模式敲入disable 退出到用户模式Router>enable //在用户模式敲入enable 进入特权模式Router#configure terminal //在特权模式敲入configure terminal 进入到配置模式Router(config)#interface ethernet 0/0 //在配置模式敲入“interface+接口类型+接口编号”进入接口模式Router(config-if)#exit //敲入exit 退出接口模式Router(config)#router rip //敲入“router + 路由协议”进入router 模式Router(config-router)#exit //退出router 模式Router(config)#line console 0 //进入line 模式Router(config-line)#end //从line 模式退出(任何时候敲入end 会退出到特权模式)Router#conf tRouter(config)#interface ethernet 0/0.1 //进入子接口模式Router(config-subif)#end //任何时候敲入end 会退出到特权模式Router#2.为路由器定义名称router(config)#hostname xxx(xxx 为我们定义的名称)Router(config)#host fxhfxh(config)#定义路由器的名称为FXH,那么对路由器定义名称,是为了区别我们所操作所有设备的不同.3.为路由器添加特权密码router(config)#enable password sss(sss 为我们定义的明文密码)router(config)#enable secret cisco (cisco 为我们定义的密文密码)router(config)#service password-encryption //对口令进行加密,加密console 口或VTY 或是enable password 设置的密码,密码不再显示明文4.不执行DNS 解析router(config)#no ip domain-lookup (这条命令的作用是:当我们在执行命令错误的时候,路由器会认为这条命令没有错误,它只是一个域名的形式,那么他会给你解析,这样,很浪费我们宝贵的时间5.配置路由器,使得控制台端口不会中止你的连接。
路由器的配置命令总结配置路由器的命令可以分为以下几类:1. 基础配置命令:- configure terminal:进入全局配置模式- hostname:设置路由器的主机名- enable password:设置特权模式密码- line console 0:进入控制台线路配置模式- line vty 0 4:进入虚拟终端线路配置模式2. 接口配置命令:- interface interface_name:进入接口配置模式- ip address:配置接口IP地址- no shutdown:激活接口- description:为接口添加描述信息3. 路由配置命令:- ip route destination_network next_hop:配置静态路由- router rip:进入RIP路由器配置模式- network:指定RIP协议工作的网络地址4. 网络地址转换(NAT)配置命令:- ip nat inside source static inside_local_ip outside_global_ip:配置静态NAT- ip nat pool pool_name start_ip end_ip netmask:配置动态NAT 池5. 访问控制列表(ACL)配置命令:- access-list acl_number {deny | permit} source destination:创建ACL规则- interface interface_name:进入接口配置模式- ip access-group acl_number {in | out}:应用ACL到接口6. VLAN配置命令:- vlan vlan_id:创建VLAN- switchport mode {access | trunk}:配置接口模式7. 安全配置命令:- enable secret:设置特权模式加密密码- username username password password:创建本地用户8. 特定协议配置命令:- router ospf process_ID:进入OSPF路由器配置模式- network network_address wildcard_mask area area_number:配置OSPF网络- router bgp autonomous_system_number:进入BGP路由器配置模式- neighbor ip_address remote-as autonomous_system_number:配置BGP邻居以上是一些常见的路由器配置命令,不同型号和品牌的路由器可能会有一些差异,具体命令请参考相应的操作手册或文档。
路由器的配置命令Router> (用户模式)Router>enable (进入特权模式)Router# (特权模式)Router#configure terminal (进入全局配置模式)Router(config)# (全局配置模式)Router(config)#hostname XXX (设置路由器主机名)Router(config)#enable password 123 (设置特权非密口令)Router(config)#enable secret 123 (设置特权加密口令)Router(config)#interface f0/6 (进入端口配置模式)Router(config-if)# (端口配置模式)Router(config)#line consode 0 (进入控制台端口)Router(config)#line vty 0 4 (进入虚拟终端配置模式)Router(config- line)# (虚拟终端配置模式)Router(config)#router rip (进入rip路由协议配置模式)Router(config-router) ( rip路由协议配置模式)Router(config-router)network 159.105.0.0 (设置参与RIP协议的网络地址,不支持可变长掩码,只有IP网络号)Router(config)#router ospf 63 (进入ospf路由协议配置模式)Router(config-router) # ( ospf路由协议配置模式)Router#write memory (保存配置到路由器的NVRAM中)Router#write network tftp (保存配置到TFTP服务器中)Router#write erase (删除路由配置)设置模式(setup) 刚出厂第一次建立配置文件RXBOOT模式密码丢失,进入可以恢复密码exit逐级退出end 或ctrl+z 直接退至特权模式基本命令:telnet ping trace showtelnet 可以由一台路由器登录到另一台路由器,最多支持5个连接。
路由器的配置命令1.路由器的模式Router>用户模式Router#特权模式Router(config)#配置模式Router(config-if)# 接口模式Router(config)#interface f0/0.1 进入子接口Router(config-subif)# 子接口模式Router(config-line)# 进行线模式Router(config-router)# 路由配置模式2.配置静态路由条目Router(config)# ip route 192.168.10.0 255.255.255.0 192.168.9.2 /192.168.10.0网段及掩码需要经过相邻路由器接口的IP地址3.配置默认路由Router B(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2 /所以外出的数据包如果找不到路由表目均找192.168.2.2接口。
4.配置路由控制台密码teacher(config)#line console 0teacher(config-line)#loginteacher(config-line)password ciscoteacher(config)#enable password cisco /配置特权模式密码teacher(config)#enable secret 1234 /配置加密保存的密码teacher(config)#service password-encryption / 对所有密码加密5.配置控制台会话时间teacher(config)#line console 0teacher(config-line)exec-timeout 0 06.配置控制台输出日志同步teacher(config)#line console 0teacher(config-line)#logging synchronous7.路由密码恢复(1)进入ROM Monitor 模式(2)修改配置寄存器的值,启动是绕过 startup-config文件rommon1>confreg ox2140rommon2>reset(3)用startup-config覆盖running-configROuter#copy starup-config running-config修改密码Router(config)#enable password cisco(4)修改配置寄存器的值Router(config)#config-register ox21028.动态路由配置(1)截断超时(2)打开接口(3)为接口设置IP 地址Router(config)#interface f0/0Router(config-if)#ip address 192.168.1.1Router(configif)#no shutdown(4)启动RIP进程,并宣告主网络号Router(config)#router ripRouter(config-router)#network 192.68.1.09.单臂路由配置Router(config)#interface f0/0.1router(config-subif)#encapsolution dotlq 1 :子接口封装dot1q针对的是VLAN1Router(config-subif)#ip address 192.168.1.1 255.255.255.0 :设置VLAN的网关地址Router(config)#interface f0/0.2router(config-subif)# encapsolution dotlq 2 子网接口封装do1q针对的是VLAN2 Router(config-subif)# 192.168.2.1 255.255.255.0 :设置VLAN2的网关地址路由器的操作系统,它是一个功能非常强大的系统,特别是在一些高档的路由器中,它具有相当丰富的操作命令,就像我们的DOS系统一样。
路由器的配置命令路由器的配置命令可以通过命令行界面(CLI)或者图形用户界面(GUI)来完成。
在命令行界面下,我们可以使用不同的命令,来对路由器进行配置和管理。
一、基本配置命令1. 进入特权模式在配置路由器之前,我们需要进入特权模式。
在命令行界面中输入以下命令,然后按下回车键即可:```enable```2. 进入全局配置模式进入特权模式之后,我们需要进入全局配置模式。
在全局配置模式下,可以对路由器进行各种配置。
在命令行界面中输入以下命令,按下回车键即可:```configure terminal```3. 配置主机名在全局配置模式下,我们可以为路由器配置一个唯一的主机名,以区分其他路由器。
在命令行界面中输入以下命令,按下回车键即可:```hostname Router1```这里的"Router1"可以替换为你想要的主机名。
4. 配置密码为了保护路由器的安全,我们可以为路由器配置密码。
以下是两种常用的密码配置命令:为特权模式设置密码:```enable secret password```为虚拟终端线路设置密码:```line vty 0 4password passwordlogin```这里的"password"可以替换为你想要的密码。
二、接口配置命令1. 进入接口配置模式在全局配置模式下,我们可以进入接口配置模式,对特定接口进行配置。
以下是两个常用的进入接口模式的命令:进入以太网接口配置模式:```interface Ethernet0/0```进入串口接口配置模式:```interface Serial0/0```2. 配置IP地址在接口配置模式下,我们可以为接口配置IP地址。
以下是一个配置IP地址的命令示例:```ip address 192.168.0.1 255.255.255.0```这里的"192.168.0.1"和"255.255.255.0"可以替换为你想要的IP地址和子网掩码。
路由器配置命令全集(专为来不及收藏的哥们送上的)命令状态1. router>路由器处于用户命令状态,这时用户可以看路由器的连接状态,访问其它网络和主机,但不能看到和更改路由器的设置内容。
2. router#在router>提示符下键入enable,路由器进入特权命令状态router#,这时不但可以执行所有的用户命令,还可以看到和更改路由器的设置内容。
3. router(config)#在router#提示符下键入configure terminal,出现提示符router(config)#,此时路由器处于全局设置状态,这时可以设置路由器的全局参数。
4. router(config-if)#; router(config-line)#; router(config-router)#;… 路由器处于局部设置状态,这时可以设置路由器某个局部的参数。
5. >路由器处于RXBOOT状态,在开机后60秒内按ctrl-break可进入此状态,这时路由器不能完成正常的功能,只能进行软件升级和手工引导。
6. 设置对话状态这是一台新路由器开机时自动进入的状态,在特权命令状态使用SETUP命令也可进入此状态,这时可通过对话方式对路由器进行设置。
返回目录三、设置对话过程1. 显示提示信息2. 全局参数的设置3. 接口参数的设置4. 显示结果利用设置对话过程可以避免手工输入命令的烦琐,但它还不能完全代替手工设置,一些特殊的设置还必须通过手工输入的方式完成。
进入设置对话过程后,路由器首先会显示一些提示信息:--- System Configuration Dialog ---At any point you may enter a quest ion mark ‘?‘ for help.Use ctrl-c to abort configuration dialog at any prompt.Default settings are in square brackets ‘[]‘.这是告诉你在设置对话过程中的任何地方都可以键入“?”得到系统的帮助,按ctrl-c可以退出设置过程,缺省设置将显示在‘[]’中。
路由器配置代码总汇手则(所有实验)路由器配置代码总汇手则(所有实验)路由器配置是计算机网络实验中的重要内容之一,合理有效地配置路由器能够提升网络的性能和安全性。
本文将总结并介绍路由器配置的代码手则,包括常用的配置指令和实验操作步骤。
以下是不同实验中的路由器配置代码总汇手则:实验一:基本路由器配置1. 登录路由器:在命令提示符窗口中输入以下指令登录到路由器:```telnet 192.168.1.1```2. 进入特权模式:使用以下指令进入特权模式:```enable```3. 进入全局配置模式:输入以下指令进入全局配置模式:```configure terminal```4. 配置路由器主机名:通过以下指令为路由器设置主机名:```hostname Router1```5. 配置管理接口的IP地址:使用以下指令为管理接口设置IP地址和子网掩码:```interface FastEthernet0/0ip address 192.168.1.2 255.255.255.0no shutdown```6. 配置路由:使用以下指令配置路由表:```ip route 0.0.0.0 0.0.0.0 192.168.1.1```7. 保存配置:输入以下指令保存配置并退出配置模式:```endwrite```实验二:网络地址转换(NAT)配置1. 进入全局配置模式:使用以下指令进入全局配置模式:```configure terminal```2. 配置NAT池:通过以下指令配置NAT池的起始IP地址和结束IP地址:```ip nat pool NATPOOL 203.0.113.1 203.0.113.10 netmask 255.255.255.0```3. 配置访问控制列表(ACL):使用以下指令配置ACL以允许需要进行NAT转换的IP地址范围:```access-list 1 permit 10.0.0.0 0.255.255.255```4. 配置内外部接口:输入以下指令配置内部和外部接口,并将NAT与ACL绑定:```interface FastEthernet0/0ip nat insideip access-group 1 ininterface Serial0/0/0ip nat outside```5. 启用NAT:使用以下指令启用NAT功能:```ip nat inside source list 1 pool NATPOOL overload```6. 保存配置:输入以下指令保存配置并退出配置模式:```endwrite```实验三:路由器安全配置1. 登录路由器:在命令提示符窗口中输入以下指令登录到路由器:```telnet 192.168.1.1```2. 进入特权模式:使用以下指令进入特权模式:```enable3. 进入全局配置模式:输入以下指令进入全局配置模式:```configure terminal```4. 配置登录认证:使用以下指令为路由器设置登录认证方式和密码:```line vty 0 15login localpassword [password]```请将 `[password]` 替换为您设置的密码。
路由器配置常用命令汇总路由器是连接网络设备的关键组件,用于将网络流量从一个网络传输到另一个网络。
配置路由器是网络管理员的重要任务之一,通过配置路由器,管理员可以确保网络安全,优化网络性能和管理网络流量。
下面是常用的路由器配置命令的汇总。
1.基本设置命令- enable:进入特权模式- configure terminal:进入全局配置模式- hostname [name]:设置路由器主机名- interface [interface-name]:进入接口配置模式- ip address [ip-address] [subnet-mask]:设置接口的IP地址和子网掩码2.接口配置命令- shutdown:关闭接口- no shutdown:启用接口- description [description]:为接口添加描述信息- speed [speed]:设置接口速率- duplex [duplex]:设置接口双工模式(全双工或半双工)3.路由配置命令- ip route [network-address] [subnet-mask] [next-hop-address]:添加静态路由- ip default-gateway [default-gateway-address]:设置默认网关- router rip:进入RIP路由协议配置模式- network [network-address]:启用RIP协议,并指定需要进行路由的网络地址4.网络地址转换(NAT)命令- ip nat inside source static [local-ip] [global-ip]:静态NAT配置- ip nat inside source list [access-list-number] interface [interface-name] overload:动态NAT配置- access-list [access-list-number] permit [source-address] [subnet-mask]:创建ACL以定义需要进行NAT转换的源地址5.防火墙配置命令- access-list [access-list-number] permit [source-address] [subnet-mask]:创建允许流量通过的ACL规则- access-list [access-list-number] deny [source-address] [subnet-mask]:创建阻止流量通过的ACL规则- interface [interface-name] ip access-group [access-list-number] in/out:将ACL应用到接口的进出方向6.路由器安全配置命令- enable secret [password]:设置特权模式密码- username [name] password [password]:创建本地用户名和密码- line vty 0 4:进入虚拟终端配置模式- login local:启用本地用户名和密码验证- service password-encryption:对密码进行加密7.服务配置命令- ip dhcp pool [pool-name]:创建DHCP地址池- network [network-address] [subnet-mask]:指定地址池所在的网络地址和子网掩码- default-router [default-gateway-address]:指定默认网关- dns-server [dns-server-address]:指定DNS服务器地址8.路由器监控和故障排除命令- show interface [interface-name]:显示接口信息- show ip route:显示路由表- show ip interface brief:显示接口摘要信息- show ip nat translations:显示NAT转换信息- ping [ip-address]:向指定IP地址发送ping命令进行连通性测试这只是一部分常用的路由器配置命令,实际使用中还有更多的命令可用于不同的路由器配置场景。
命令汇总
show ip route 查看路由表
show ip protocols 查看IP 路由协议配置和统计信息
show ip rip database 查看RIP 数据库
debug ip rip 动态查看RIP 的更新过程
clear ip route * 清除路由表
router rip 启动RIP 进程
network 通告网络
version 定义RIP 的版本
no auto-summary 关闭自动汇总
ip rip send version 配置RIP 发送的版本
ip rip receive version 配置RIP 接收的版本
passive-interface 配置被动接口
neighbor 配置单播更新的目标
ip summary-address rip 配置RIP 手工汇总
show ip route 查看路由表
show ip ospf neighbor 查看OSPF 邻居的基本信息
show ip ospf database 查看OSPF 拓扑结构数据库
show ip ospf interface 查看OSPF 路由器接口的信息
show ip ospf 查看OSPF 进程及其细节
debug ip ospf adj 显示OSPF 邻接关系创建或中断的过程debug ip ospf events 显示OSPF 发生的事件
debug ip ospf packet 显示路由器收到的所有的OSPF 数据包router ospf 启动OSPF 路由进程
router-id 配置路由器ID
network 通告网络及网络所在的区域
ip ospf network 配置接口网络类型
ip ospf cost 配置接口cost 值
ip ospf hello-interval 配置hello 间隔
ip ospf dead-interval 配置OSPF 邻居的死亡时间
ip ospf priority 配置接口优先级
auto-cost reference-bandwidth 配置参考带宽
clear ip ospf process 清除OSPF 进程。