路由器交换机配置命令

合集下载

交换机路由器配置命令

交换机路由器配置命令

交换机和路由器配置命令(必须掌握)交换机设置登录密码全局:line console 0:Password 123:login设置用户到特权密码全局:en password 123:en secret 123:no en secret (删除密码)为交换机配IP全局:in vl 1:ip ad 192.168.1.1 255.255.255.0:no sh为交换机配网关全局:ip default-gateway 192.168.1.10恢复交换机出厂值特权:erase startup-config (清空):reload (重启)删除所有VLAN 全局:no vl 1 - 1005创建VLAN全局:vl 2 (用于真机):in vl 2:name test 2 (改名为test 2)特权:vl database (用于虚拟机和真机):vl 2 name test 2添加端口到VL 全局:in ra(多个) f0/1 – 10:sw ac vl 2从VL删除端口全局:in ra(多个)f0/1 – 10:no sw ac vl 2配置中继链路全局:in f0/1:sw mode trunk:no sh (激活端口)在trunk中添加、删除VL全局:in f0/1:sw tr allowed vl remove vl 2(删除) 全局:in f0/1:sw tr allowed vl add vl 2(添加)路由器以上命令是我认为学交换机和路由器必须要掌握的。

先就为大家收集这么多了,希望大家能好好学习。

当中可能会存在错误,如果大家发现请及时通知我。

谢谢~!SIT806——无敌精英班 班长留给路由器接口配IP全局:in f0/1:ip ad 192.168.2.2 255.255.255.0 :no sh配置单臂路由全局:in f0/0.1:encapsulation dot1q 1(VL1) :ip ad 192.168.1.1 255.255.255.0查看路由表特权:sh ip route关闭路由全局:no ip routing添加逻辑端口全局:int loopback 0配置默认路由全局:ip route 0.0.0.0 0.0.0.0 address(下一跳IP)配置静态路由 全局:ip route 192.168.1.0 255.255.255.0 192.168.2.1配置动态路由全局:router rip:network 172.25.0.0(所有直连网段)RIP V2的配置全局:router rip:version 2:no auto-summary (关闭汇总)设置远程管理全局:line vty 0 4(允许0到4,五个用户登录):login:pawwword 123全局:enable password 123。

路由与交换的配置命令

路由与交换的配置命令

1、switch>:用户模式——能查看版本信息2、在用户模式下输入enable会进特权模式——它能保存、修改、删除这一系列的配置switch>enable→switch#:特权模式,下面有一些命令就在此命令下完成:①、删除vlan的文件配置:delete flash:vlan.dat②、删除vlan中的配置文件:erase startup-config③、查看vlan配置文件是否被删除及vlan的是否创建:show vlan④、重新启动交换机:reload⑤、查看当前交换机的配置:show running-config⑥、保存对交换机所配置的内容,即是保存在Nvram:copy running-configstartup-config⑦、检查Nvram的内容:show startup-config⑧、检查虚拟接口 vlan的特征:show interface vlan 1⑨、查看接口IP的属性:show ip interface vlan 1⑩、查看cisco的信息:show version⑪、查看交换机所用快速以太网接口的默认属性:show interface fastethernet 0/18⑫、查看闪存目录中的内容:show flash 或dir flash3、在特权模式下输入configure terninal后会进入全局模式,一切的配置必须在此模式中进行配置Switch#configure terninal→switchp(config)#:全局模式①、配置路由器设备的名字:switch(config)#hostname + 交换机的名字②、配置进入特权模式的密码,即使能密码:switch(config)#enable password +密码③、配置非明文密码:switch(config)#enable secret + 密码4、为交换机配置console口①、进入现成配置模式,即进入console口:switch(config)# line console 0②、设置密码(重新启动时需要此密码):switch(config-line)#password + 密码③、允许登录:switch(config-line)#login5、配置远程登录的密码:①、首先要配置使能密码②、允许让几个人登录:switch(config)#line vty 0 4(即允许五个登录)③、设置密码:switch(config-line)#password + 密码④、允许远程登录:switchp(config-line)#login6、在全局模式下的有关命令①对所有密码进行加密:switch(config)#service password-encryption②、不解析错误的命令:switch(config)#no ip domain-lookup7、创建vlan(2—1001,注vlan 1既不可以创建,也不可以删除)①、创建vlan :vlan + 要创建vlan的值②、给vlan取名:switch(config-vlan)#name + 名字(此步可以不要)③、把PC与交换机相连的端口添加到相应的vlan中:a、Switch(config)#interface + 端口b、Switch(config-if)#switchport access vlan + 相应vlan的值④、需要传递多个vlan信息就要打中继口,即trunka、switch(config)#interface + 交换机另一端口b、switch(config-if)#switchport mode trunk8、传统vlan 的通信(1)、router的配置①、为接口配置IP地址(该IP是相应vlan的PC网关)②、激活端口:no shutdown(2)、switch的配置①、创建vlan,将PC端口划入相应vlan②、将switch与router相连的端口划入相应的vlan(3) 、PC的配置:就是给PC配置IP,注PC的默认网关与router的IP相同,网关相同9、单臂路由实现vlan的通信(1)router配置①、添加子接口:interface f0/0.1(此处有多少个vlan就添加多少个子接口)②、将子接口封装到相应的vlan:encapsulation dot + 相应vlan的值③、将子接口配置IP:ip add +ip地址 + 子网掩码④、激活物理接口:no shutdown(2)、switch的配置①、创建 vlan,交PC的端口划入到相应vlan②、与router相连的端口打trunk(3)、配置PC的IP9、三层交换(1)、配置三层交换①、启用三层交换:(config)#ip routing②、创建vlan:(config)# vlan + 要创建vlan的值③、把相应的vlan配置IPa、指定一个vlan:(config)#interface vlan + vlan相应的值c、配置IP:(config-if)#ip add + ip + 子网掩码(2)、配置switch①、每个交换机创建vlan②、把端口划分到相应的vlan中③、打中继口(trunk)Show命令1、show version 这个命令可以查看IOS版本号,已启动时间,Flash中的IOS 的文件名,router里面共有什么端口,寄存器的值等等。

华为路由器交换机常用命令

华为路由器交换机常用命令

华为路由器交换机常用命令一、设备管理命令1.登录管理命令- ssh [ip地质] -p [端口号]:通过SSH协议登录设备。

- telnet [ip地质]:通过Telnet协议登录设备。

- logout:退出设备。

2.用户管理命令- display current-configuration:显示当前设备配置信息。

- save:保存当前配置。

- undo save:取消保存的配置。

- super:切换到超级用户模式。

- user-interface console 0:配置控制台终端的参数。

- user-interface vty 0 4:配置远程登录终端的参数。

3.设备操作命令- reboot:重启设备。

- reset saved-configuration:恢复出厂配置。

- display version:显示设备的硬件和软件版本信息。

- display device:显示设备的基本信息。

- display interface[接口名称]:显示指定接口信息。

- display ip routing-table:显示IP路由表信息。

二、网络配置命令1.IP配置命令- interface [接口名称]:进入指定接口。

- ip address [IP地质] [子网掩码]:配置接口IP地质。

- undo ip address:取消接口IP地质配置。

- ip route-static [目标网络] [子网掩码] [下一跳地质]:配置静态路由。

- undo ip route-static [目标网络] [子网掩码] [下一跳地质]:取消静态路由配置。

2.VLAN配置命令- vlan [VLAN ID]:创建指定VLAN。

- quit:退出VLAN配置模式。

- interface vlan [VLAN ID]:进入指定VLAN接口。

- ip address [IP地质] [子网掩码]:为VLAN接口配置IP地质。

交换机路由器基本命令大全

交换机路由器基本命令大全

基础:1.VrrpVrrp:虚拟路由网关冗余协议L3-1 (config)#vlan database //创建vlanL3-1 (config)#vlan 10 / vlan 20 / vlan 30 / vlan 40L3-1 (config-vlan)#interface vlan 10 / vlan 20L3-1 (config-if)#no shutdownL3-1 (config-if)#ip add 192.168.10.1 / 192.168.20.1 / 192.168.30.1 / 192.168.40.1 255.255.255.0L3-1 (config-if)#vrrp 1 ip192.168.10.254 / 192.168.20.254 //vrrp配置虚拟ipL3-1 (config-if))#vrrp1priority 254 //配置vrrp的优先级L3-1 (config-if))#vrrp 1 preempt //抢占L3-1 (config-vlan)#interface vlan 30 / vlan 40L3-1 (config-if)#vrrp 2 ip 192.168.30.254 / 192.168.40.254 //vrrp配置虚拟ip /*L3-1 (config-vlan)#vrrp 1 authentication text 1234 //双方认证加密*/L3-2 (config)#vlan database //创建vlanL3-2 (config)#vlan 10 / vlan 20 / vlan 30 / vlan 40L3-2 (config-vlan)#interface vlan 10 / vlan 20 / vlan 30 / vlan 40L3-2 (config-if)#no shutdownL3-2 (config-if)#ip add 192.168.10.1 / 192.168.20.1 / 192.168.30.1 / 192.168.40.1 255.255.255.0L3-2 (config-if)#vrrp 2 ip 192.168.30.254 / 192.168.40.254 //vrrp配置虚拟ipL3-2 (config-if))#vrrp 2 priority 254 //配置vrrp的优先级L3-2 (config-if))#vrrp 2 preempt //抢占L3-2 (config-vlan)#interface vlan 10 / vlan 20L3-2 (config-if)#vrrp 1 ip 192.168.10.254 / 192.168.20.254 //vrrp配置虚拟ipL3-1#show vrrp brief //查看vrrp配置信息HsrpRouter (config)#interface fa0/1 ip 192.168.1.3 255.255.255.0 //进入端口配置ipRouter (config-if)#standby 2 //创建组Router (config-if)#standby 2 ip 192.168.1.254 //组添加ipRouter (config-if)#standby priority 200 //设置优先级,默认优先级100Router (config-if)#standby 2 preempt //抢占Router (config-if)#standby timers 3-10 //虚拟报文时间间隔Router (config-if)#standby 2 tranck fa0/0 //跟踪上行端口Router#show standby brief //查看热备份配置信息2.Mstp:多生成树协议Switch (config)#spanning-tree //启动生成树协议Switch (config)#spanning-tree mode mstp //设置生成树模式是mstpSwitch (config)#vlan 10Switch (config-vlan)#exitSwitch (config)#vlan 20Switch (config-vlan)#exitSwitch (config)#spanning-tree mst 1 priority 4096 //生成树组1的优先级设为4096 Switch (config)#spanning-tree mstconfigwration //进入生成树配置模式Switch (config)#instance 1 vlan 10,20 //把vlan10,20添加到组13.链路聚合L3-1 (config)#interface port-channel 1 //创建组L3-1 (config-if)#no shutdownL3-1(config-if)#switchport mode trunkL3-1(config-if)#interface fa1/13 //进入三层交换机间相连接口L3-1(config-if)#channel-group 1 mode on //添加到组中L3-1 (config-if)#switchport mode trunkL3-1 (config-if)#no shutdownL3-1 (config-if)#interface fa1/14L3-1 (config-if)#channel-group 1 mode onL3-1 (config-if)#switchport mode trunkL3-1 (config-if)#no shutdownL3-2(config)#interface port-channel 1 //创建组L3-2(config-if)#no shutdownL3-2(config-if)#switchport mode trunkL3-2(config-if)#interface fa1/13 //进入三层交换机间相连接口L3-2(config-if)#channel-group 1 mode on //添加到组中L3-2(config-if)#switchport mode trunkL3-2(config-if)#no shutdownL3-2(config-if)#interface fa1/14L3-2(config-if)#channel-group 1 mode onL3-2(config-if)#switchport mode trunkL3-2(config-if)#no shutdown4.VLAN(vtp)●Vtp(truch接口):Switch(config)#Vtpnamezjq //vtp命名zjqSwitch(config)#vtp password 123456 //设置vtp密码Switch(config)#vtp mode server(client) //vtp的模式设置为服务器或者客户端Switch(config)#interface FastEthernet0/1Switch(config)#switchport mode trunk //接口模式设置为trunk●配置vlanSwitch(config)#Vlan databaseSwitch(config)#Vlan 10 name xingzhengbuSwitch(config)#Switchport access vlan 10Switch(config)#Ip address 192.168.80.254 255.255.255.05.Tftp//打开tftp服务器,获取ip地址L2-1>enL2-1#copy startup-configtftp //Address of remote host []?172.16.25.0Destination filename [config.text]?zhangjq.txt6.telnet:远程登录Switch(config)#hostname silence //修改设备名称Switch(config)#intvlan 1Switch(config-if)#ip add 192.168.1.1 255.255.255.0 //设置管理交换机的IP地址Switch(config-if)#no shutdown //启用接口Switch(config)#enable secret 123456 //配置进入特权模式的密码为123456 Switch(config)#line vty 0 15//进入VTY端口,允许16台电脑同时远程登录Switch(config-line)#pass cisoco //设置Telnet的登录密码为ciscoSwitch(config-line)#login //允许Telnet登录7.管理VLAN扩展:1.路由引入(ospf)●静态路由配置(Static):要到达的网段Nwtwork:192.168.3.0/24设置下一跳Next Hop:192.168.1.2Router(config)#ip route 0.0.0.0 0.0.0.0 fa0/1●动态路由RIP:公布自己有的网段192.168.2.0/192.168.3.0OSPF:开放式最短路径协议Router(config)#router ospf 1 //启动OSPF协议,进程号Router(config)#network 192.168.1.0 0.0.0.255 area 0 //公布自己有的网段,划分区域Router(config)#do show iproute //查看路由表修改链路的开销1.Router(config-if)#bandwidth bamdwidth-kbps //修改接口的带宽参数2.Router(config-if)#ipospf cost “加数字”//命令则直接将链路开销设置为特定值并免除了计算过程2.DHCP的配置:动态主机配置协议L3-1(config)#vlan 10 //创建vlanL3-1(config-if)#intvlan 10L3-1(config-if)#ip add 192.168.10.1 255.255.255.0L3-1(config-if)#no shutdownL3-1 (config)#service dhcp //启动dhcpL3-1 (config)#ipdhcp pool <name> //建立地址池L3-1 (config)#network <network-number><mask> //动态分配ip的网段和MAC地址L3-1 (config)#default-router <ip-address> //为dhcp客户设置默认网关L2-1 (config)#interface fa0/0L2-1 (config-if)#sw mode trunkL2-1 (config-if)no shutdownL2-1 (config)#interface fa0/15L2-1 (config-if)#switchport mode accessL2-1 (config-if)#switchport access vlan 10 //绑定vlan 10L2-1 (config-if)no shutdownPC(config)#no ip routing //取消路由功能PC(config)#interface fa0/0PC(config-if)#ip add dhcpPC(config)#default gateway <ip-address>PC#show interface fa0/03.无线路由器AP>ap-mode fatAP>enAP#config tAP(config)#vlan 10AP(config-vlan)#exitAP(config)#service dhcpAP(config)#ipdhcp pool zhangjqAP(dhcp-config)#network 192.168.10.0 255.255.255.0AP(dhcp-config)#dns-server 10.20.5.1AP(dhcp-config)#default-router 192.168.10.254AP(dhcp-config)#interface gigabitEthernet0/1AP(config-if-GigabitEthernet 0/1)#encapsulation dot1Q 10 //封装vlan10AP(config-if-GigabitEthernet 0/1)#interface BVI 10AP(config-if-BVI 6)#ip add 192.168.10.254 255.255.255.0AP(config-if-BVI 6)#exitAP(config)#dot11 wlan10AP(dot11-wlan-config)#vlan10AP(dot11-wlan-config)#broadcast-ssidAP(dot11-wlan-config)#ssidzhangjqAP(dot11-wlan-config)#exitAP(config)#interface dot11radio 1/0AP(config-if-Dot11radio 1/0)#encaosulation dot1Q 10AP(config-if-Dot11radio 1/0)#mac-mode fatAP(config-if-Dot11radio 1/0)#channel 1AP(config-if-Dot11radio 1/0)#wlan-id 1AP(config-if-Dot11radio 1/0)#ip router 0.0.0.0 0.0.0.0 192.168.1.254AP(config)#intwlansec 10AP(config-if-wlansec 10)#security wpa enableAP(config-if-wlansec 10)#security wpa ciphers aes enableAP(config-if-wlansec 10)#4.ACL:访问控制列表标准控制列表:Router(config)#access-list 1 permit 192.168.2.0 0.0.0.255 //创建控制列表允许2网段可以访问,<1-99>标准访问控制列表;<100-199>扩展访问控制列表Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255Router(config)#access-list 1 deny 192.168.0.0 0.0.0.255 //创建控制列表拒绝0网段可以访问,反向子网掩码Router(config)#interface se3/0 //进入se3/0Router(config-if)#ip access-group 1 out //把访问控制列表应用到接口Se3/0扩展控制列表:<才需要填写目标ip>Router(config)#access-list 101 permit ip 192.168.2.0 0.0.0.255 10.0.0.0 0.255.255.255 //创建控制列表允许源ip访问目标ip,能访问web和ping通Router(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 10.0.0.0 0.255.255.255 eq www //创建控制列表允许源ip访问目标ip的80端口,能访问web不能ping通Router(config)#access-list 101 permit icmp 192.168.0.0 0.0.0.255 10.0.0.0 0.255.255.255 //创建控制列表允许源ip访问目标ipRouter(config)#interface se3/0Router(config-if)#ip access-group 101 outSe3/0●使用ACL保护路由安全Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255Router(config)#line vty 0 15Router(config)#access-class 1 inRouter(config)#password hanlg5.NAT:地址转换●静态NAT(出口路由配置,私网地址转换成公网地址)Router(config)#ipnat inside source static【静态】私网ip公网(外)ip //内部网转换为外部网地址Router(config)#interface f0/1Router(config-if)#ipnat outside //绑定对外接口Router(config)#interface f0/2Router(config-if)#ipnat inside //绑定对内接口●动态NATRouter>enRouter#config tRouter(config)#access-list 10 permit 10.0.0.0 0.0.0.255Router(config)#ipnat pool zhangjq 131.107.0.1 131.107.0.6 netmask 255.255.255.0 Router(config)#ipnat inside source list 10 pool zhangjqRouter(config)#interface se0/0Router(config-if)#ipnat outsideRouter(config-if)#interface fa0/1Router(config-if)#ipnat insideRouter(config-if)#endRouter(config-if)#show ipnat translations●超载NAT(PAT)Router>enRouter#config tRouter(config)#access-list 10 permit 10.0.0.0 0.0.0.255Router(config)#ipnat pool zhangjq 131.107.0.1 131.107.0.1netmask 255.255.255.0 Router(config)#ipnat inside source list 10 pool zhangjqoverloadRouter(config)#interface se0/0Router(config-if)#ipnat outsideRouter(config-if)#interface fa0/1Router(config-if)#ipnat insideRouter(config-if)#endRouter(config-if)#show ipnat translations6.802.1xL2-1 (config)#aaa new-model //启动aaa服务L2-1 (config)#aaa authentication dot1x default group radius //认证802.1x,启用默认列表default,采用radius认证方式L2-1 (config)#dot1x authentication default //启用default列表应用L2-1 (config)#radius-server host 172.16.32.2 //配置radius服务器地址L2-1 (config)#radius-server key 123456 //设置交换机和服务器之间的密码L2-1 (config)#dot1x auth-mode chap //身份验证的加密方式改为chapL2-1 (config)#interface range fa0/1 - 22 //进入交换机的下行接口L2-1 (config-if)#dot1x port-control auto //在端口启用802.1x绑定vlanL2-1(config)#interface fa0/0L2-1(config)#switchport mode accessL2-1(config)#switchport access vlan10●打错Switch(config)#no ip domain-lookup●配置单臂路由Router(config)#inter fa0/0.10 //创建虚拟接口Router(config-subif)#encapsulation dot1Q 10 //封装(vlan)协议Router(config-subif)#ip address 192.168.1.1 255.255.255.0 //添加网关Router(config-subif)#no shutdown●路由引入Router(config-if)#default-information originate●回环路由(虚构一条路)Router(config)#int loopback 回环路由号Ip route 0.0.0.0 0.0.0.0 loopback 0●交换机端口安全配置Switch (config)#interface fastsernet0/1 //进入端口配置模式Switch (config-if)#speed 10 //设置端口速率为10Mbit/s,{10|100|auto}Switch (config-if)#duplex half //设置端口为半双工,{half|full|auto}Switch (config-if)#no shutdown //启用端口Switch (config-if)#switchport mode access //设置当前端口为access,交换机端口安全功能只能在access接口进行配置Switch (config-if)#switchport port-security //打开当前端口安全功能,默认关闭端口安全功能Switch (config-if)#switchportport-security maximum 10 //设置端口安全地址的最大个数,最大安全地址个数是128个Switch (config-if)#switchport port-security violation shutdown //配置处理违例的方式,默认处理方式为protectSwitch (config-if)#switchport port-security mac-address 0007.EC56.5906 //配置安全地址Switch (config-if)#endSwitch#show port-security interface fastethernet0/1 //查看0/1的端口安全配置信息,<Half-duplex,10Mb/s //已设置为半双工,10Mbit/s>Switch#show port-security //查看所有安全端口的统计信息●光电复用口L3-1 (config)#interface gi0/26L3-1 (config-GigabitEthernet 0/26) #medium-type fiberL3-2 (config)#interface gi0/26L3-2 (configGigabitEthernet 0/26)#medium-type fiber●防火墙设置步骤1.路由模式(安全)下设置2.接口IP地址设置3.路由(默认路由)4.安全策略、安全规则(nat、包过滤、ip映射、端口映射)端口映射:nat的一种,把内网端口转换成外网端口(内网的服务器ip加上端口号映射到外网ip地址)Ip映射:静态natNat:防火墙上做nat,就是要使内网用户可以访问外网QOS(服务质量)路由器的CBWFQ配置Router(config)#class-map http_ftp //创建一个分类表,并进入分类表模式Router(config-cmap)#match protocol httpRouter(config-cmap)#match protocol ftpRouter(config-cmap)#exitRouter(config)#policy-map zhangjq //创建一个策略表,并进入策略表模式Router(config-pmap)#class http_ftp //建立一个分类表,并进入策略分类表模式Router(config-pmap-c)#bandwidth 512Router(config-pmap-c)#exitRouter(config-pmap)#class class-defaultRouter(config-pmap-c)#endRouter(config)#interface fa0/1Router(config-if)#service-policy output zhangjq //在端口上应用一个策略表Router(config-if)#endRouter#show policy-mapIPSec配置R1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1 //添加默认路由,设置下一条R1(config)#crypto isakmp policy 11 //设置IKE策略的优先级R1(config-isakmp)#encryption 3des //配置加密方式[des,3des,aes]R1(config-isakmp)#hash md5 //检验完整性,数字签名方法[md5,sha]R1(config-isakmp)#authentiaction pre-share //采用预共享密钥的认证方式R1(config)#crypto isakmp key passwd address 10.1.14.60 //协商的共享密码R1(config)#crypto ipsec transform-set one esp-3des esp-md5-hmac //配置转换集[ike配置参数转换成IPSec]R1(config)#access-list 101 permit ip 172.16.0.0 0.0.255.255 192.168.0.0 0.0.255.255//创建访问控制列表R1(config)#access-list 111 deny ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255R1(config)#access-list 111 permit ip any anyR1(config)#ip nat inside source list 111 interface fa0/1R1(config)#cryptomap my 10 ipsec-isakmp //创建加密图my,序号10R1(config-crypto-map)#set peer 10.1.14.60 //标识对方路由器IP地址R1(config-crypto-map)#set transform-set one //启用转换集R1(config-crypto-map)#match address 101 //启用ACLR1(config-crypto-map)#interface FastEthernet0/0R1(config-if)#crypto map my //启用映射R1#show crypto isakmp sa //查看配置结果IKE配置配置映射Show crypto isakmpPpp:由被验方发起单向:被验证方:Route0r#config tRouter0(config)#interface Serial0/0/0Router0(config-if)#ip address 192.168.1.1 255.255.255.0 Router0(config-if)#no shutdownRouter0(config-if)#encapsulation pppRouter0(config-if)#ppp pap sent-username r0 password 123456验证方:Router1>enableRouter1#configure terminalRouter1(config)#interface Serial0/0/0Router1(config-if)#ip address 192.168.1.2 255.255.255.0 Router1(config-if)#no shutdownRouter1(config)#username r0 password 0 123456Router1(config-if)#encapsulation ppp双向:Router3>enRouter3#config tRouter3(config)#username r4 password 0 123456Router3(config)#int se2/0Router3(config-if)#encapsulation pppRouter3(config-if)#ppp pap sent-username r3 password 123456Router4>enRouter4#config tRouter4(config)#username r3 password 0 123456Router4(config)#int se3/0Router4(config-if)#encapsulation pppRouter4(config-if)#ppp pap sent-username r4 password 123456Chap(密码要求一致):chap是由验方发起,发送随机数报文查找数据库密码,随机数+密码返回验方单向:被验证方:Router>enableRouter#configure terminalRouter(config)#hostname R1R0(config)#interface Serial0/0/0R0(config-if)#no shutdownR0(config-if)#ip address 192.168.1.1 255.255.255.0R0(config-if)#encapsulation ppp //封装pppR0(config)#username R1 password 0 123456 //建立本地用户组验证方:Router>enableRouter#configure terminalRouter(config)#hostname R1R1(config)#interface Serial0/0/0R1(config-if)#no shutdownR1(config-if)#ip address 192.168.1.2 255.255.255.0R1(config-if)#encapsulation ppp //封装pppR1(config-if)#ppp authentication chapR1(config)#username R0 password 0 123456 //建立本地用户组双向:被验证方:Router>enableRouter#configure terminalRouter(config)#hostname R1R0(config)#interface Serial0/0/0R0(config-if)#no shutdownR0(config-if)#ip address 192.168.1.1 255.255.255.0R0(config-if)#encapsulation pppR1(config-if)#ppp authentication chapR0(config)#username R1 password 0 123456验证方:Router>enableRouter#configure terminalRouter(config)#hostname R1R1(config)#interface Serial0/0/0R1(config-if)#no shutdownR1(config-if)#ip address 192.168.1.2 255.255.255.0R1(config-if)#encapsulation pppR1(config-if)#ppp authentication chapR1(config)#username R0 password 0 123456Ospf ppp模式配置:Router0>enableRouter0#configure terminalRouter0(config)#interface Serial0/0/0Router0(config-if)#encapsulation pppRouter0(config-if)#ip ospf network point-to-point Router0(config-if)#no shutdownRouter0(config-if)#exitRouter0(config)#router ospf 1Router0(config-router)#net 10.1.1.0 0.0.0.255 area 0 Router0(config-router)#endRouter1>enableRouter1#configure terminalRouter1(config)#interface Serial0/0/0Router1(config-if)#no shutdownRouter1(config-if)#encapsulation pppRouter1(config-if)#ip ospf network point-to-point Router1(config-if)#no shutdownRouter1(config-if)#exitRouter1(config)#router ospf 1Router1(config-router)#network 20.1.1.0 0.0.0.255 area 0 Router1(config-router)#endRouter1#Show ip ospf neighbor帧中继Router3>enableRouter3#configure terminalRouter3(config)#interface Serial2/0Router3(config-if)#no shutdownRouter3(config-if)#encapsulation frame-relayRouter3(config-if)#frame-relay lmi-type ciscoRouter3(config-if)#exitRouter3(config)#int s2/0.1 point-to-pointRouter3(config-subif)#ip add 192.168.2.3 255.255.255.0 Router3(config-subif)#frame-relay interface-dlci 302 Router3(config)#int se2/0.2 point-to-pointRouter3(config-subif)#ip add 192.168.3.3 255.255.255.0 Router3(config-subif)#frame-relay interface-dlci 301Router1>enableRouter1#configure terminalRouter1(config)#interface Serial2/0Router1(config-if)#no shutdownRouter1(config-if)#encapsulation frame-relayRouter1(config-if)#frame-relay lmi-type ciscoRouter1(config-if)#exitRouter1(config)#int s2/0.1 point-to-pointRouter1(config-subif)#ip add 192.168.1.1 255.255.255.0 Router1(config-subif)#frame-relay interface-dlci 102 Router1(config)#int se2/0.2 point-to-pointRouter1(config-subif)#ip add 192.168.3.1 255.255.255.0 Router1(config-subif)#frame-relay interface-dlci 103Router2>enableRouter2#configure terminalRouter2(config)#interface Serial2/0Router2(config-if)#no shutdownRouter2(config-if)#encapsulation frame-relayRouter2(config-if)#frame-relay lmi-type ciscoRouter2(config-if)#exitRouter2(config)#int s2/0.1 point-to-pointRouter2(config-subif)#ip add 192.168.1.2 255.255.255.0Router2(config-subif)#frame-relay interface-dlci 201Router2(config)#int se2/0.2 point-to-pointRouter2(config-subif)#ip add 192.168.2.2 255.255.255.0Router2(config-subif)#frame-relay interface-dlci 203Dhcp:DHCP(Dynamic Host Configuration Protocol,动态主机配置协议),基于Client/Server工作模式,DHCP服务器为需要动态获取IP地址的客户端分配IP地址及网关、dns等其它参数开启dhcp服务R1(config)#service dhcp //开启dhcp功能配置dhcp地址池R1(dhcp-config)#network 192.168.1.0 255.255.255.0 //可以分配的地址范围192.168.1.1~192.168.1.254R1(dhcp-config)#dns-server 10.2.50.1 //配置DNSR1(dhcp-config)#default-router 192.168.1.1 //配置网关地址/*R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10//192.168.1.1~192.168.1.10不被dhcp分配*/静态路由就是手工配置的路由,使得数据包能够按照预定的路径传送到指定的目标网络R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2 //目标地址是192.168.2.0/24的数据包,转发给192.168.3.2R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1 //目标地址是192.168.1.0/24的数据包,转发给192.168.3.1R1#show ip route //查看路由R2#show ip route //查看路由RIP(Routing Information Protocol)路由协议采用距离向量算法,是一种距离向量协议。

交换机和路由器常用命令大全

交换机和路由器常用命令大全

交换机和路由器配置命令Cisco 交换机的命令行模式:1、用户模式Switch>2、特权模式Switch>enableSwitch#3、全局配置模式Switch#config terminalSwitch(config)#4、接口模式Switch(config)#interface fastethernet 0/1Switch(config-if)#Fastethernet表示百兆位以太网接口。

Ethernet表示十兆位以太网接口。

Gigabitethernet表示千兆位以太网接口。

Tengigabitethernet表示万兆位以太网接口。

如果从特权模式回到用户模式,需要输入disable命令,其他无论在那个模式,只要输入命令exit就能回到前一个模式,在全局模式或是接口模式,只要输入命令end都能回到特权模式,或者按下ctrl+z 组合键等效于命令end。

(命令行帮助机制:1、“?”。

2、Tab键。

)常用快捷组合键:Ctrl+A 光标移动到命令行的开始位置。

Ctrl+E 光标移动到命令行的结束位置。

一、常用命令介绍:1、hostname 用于配置主机名,可简写为host.Switch(config)#host sw1Sw1(config)#2、show version 显示系统IOS名称以及版本信息,可简写为sh ver.3、Show running-config 查看交换机当前配置信息,可简写为shrun.4、Show startup-config 显示已保存的配置信息,可简写为sh star.5、Copy running-config startup-config 保存当前配置信息,可简写为copy run star。

这个命令还等效于write(简写为wr)。

保存当前配置如下:Switch#wr 或者switch#copy run star6、erase nvram 删除已保存的配置信息,这命令等效于erasestartup-config.(擦除)。

路由器和交换机命令大全

路由器和交换机命令大全

路由器和交换机命令大全不论是路由器也好,还是交换机也好,终归都是要依靠命令进行设备控制,因此你是否知道全部的命令呢?何不抓紧时间补全自己所缺失的命令,以便更好的进行工作开展。

「基础配置」进入console口进行本地配置用户模式xx>enable n特权模式xx#configure terminal全局配置模式 xx(config)#interface [f|s] n/m 进入接口配置模式xx(config-if)#进入(子)接口模式后配置IP(config-if)#ip addr A.B.C.D 子网掩码激活接口(config-if)#no shutdown配置速度(config-if)#speed {auto|10|100}配置接口工作模式(config-if)#duplex {auto|half|full}配置时钟(串行口DCE端)(config-if)#clock rate n反向操作(删除配置)no + 命令在换回接口上配多个ip(config-if)#ip addr A.B.C.D 子网掩码(config-if)#ip addr A.B.C.D 子网掩码 secondary查看所有配置#show running-config路由器关闭路由功能充当主机(config)#no ip routing为路由器设置网关(config)#ip default-gateway ip地址改机器名字(config)#hostname yy控制线路超时(config)#line n(config-line)#exec-timeout 0 0关闭域名解析功能(config)#no ip domain-lookup开启路由器http功能(config)#ip http server(config)#username xxx password yyy(config)#username xxx secret yyy(config)#enable secret yyy启用密码加密服务(config)#service password-encryption yyy开启路由器https功能(config)#ip http secure-server开启路由器远程登录功能(config)#line vty 0 4(config)#login local或者(config)#no login(config)#enable n登录时使用命令 telnet A.B.C.D「交换机」查看mac地址表#show mac-address-table绑定静态mac地址(config)#mac-address-table static H.H.H vlan n interface fx/x #show arp在主机上使用arp -a查看arp信息开启交换机端口安全(防止连接主机恶意发送随机mac填满mac地址表)(conifg)#switchport port-security(conifg)#switchport ?#show port-security int fx/x恢复(config)#errdisable recovery 为交换机vlan1配置管理ip(conifg)#int vlan 1(config-if)#ip addr A.B.C.D 子网掩码(config-if)#no shut「交换机vlan」查看vlan #show vlan-switch或是#show vlan创建vlan #vlan database(vlan)#vlan n将端口加入到vlan中(config-if)#switchport access vlan n给允许多个vlan的接口打trunk(config-if)#switchport mode trunk「单臂路由vlan」路由器上配置子接口实现不同vlan之间通信,先必须激活其父接口,另外IP不允许重复(config)#interface fx/x.x(config-subif)#encapsulation dot1q vlan-id(config-subif)#ip addr A.C.D.E 子网掩码(config-subif)#no shut「使用三层交换机交换虚拟接口」交换机上配置虚拟交换接口实现不同vlan之间通信,先必须在交换机上添加对应vlan(config)#int vlan n(config-if)#ip addr A.B.C.D 子网掩码(config-if)#no shut在删除时,务必先删除交换虚拟接口,再删对应vlan「VTP」配置VTP模式#vlan database(vlan)#vtp {server|client|transparent}只有域名和密码完全一样的路由器之间才能同步vlan信息(vlan)#vtp domain <域名>(vlan)#vtp password <密码>打开VTP裁剪(vlan)#vtp pruning退出激活(vlan)#exit 「端口聚合」创建R1(config)#interface port-channel 1(config-if)#switchport trunk encapsulation dot1q(config-if)#switchportmode trunk将指定接口加入聚合组内#int range f x/x-x #channel-group 1 mode on查看聚合接口#show etherchannel summary 「生成树协议」基于vlan的生成树可防止环路开启生成树协议(STP默认是开启的,可省略)(config)#spanning-tree vlan n修改生成树协议优先级(根网桥:mac最小、优先级最小)(config)#spanning-tree vlan n priority m交换机和主机之间连接的端口开启portfast,可防止主机发送BPDU伪造数据(config-if)#spanning-tree portfast查看生成树#show spanning-tree [vlan n]「静态路由」查看协议#show ip protocols查看路由表#show ip route添加静态路由(以默认路由举例)(config)#ip route 0.0.0.0 0.0.0.0 {出接口|下一跳ip}浮动静态路由(备份链路,在原链路失效后起作用)(config)#ip route 0.0.0.0 0.0.0.0 出接口AD管理距离静态黑洞路由(config)#ip route 192.168.0.0 255.255.0.0 null 0「RIP距离矢量路由,动态路由」配置RIP宣告直连网段(config)#router rip(config-router)#network 网段更改为版本2(config-router)#version {2|1}关闭自动汇总(如果被其他网路隔开时,最好关闭自动汇总)(config-router)#no auto-summary设置被动接口(只接受更新,不宣告自己)(config-router)#passive-interface 接口单播更新(只和指定的ip 交换路由信息)(config-router)#neighbor ip地址清除路由表内容#clear ip route *「OSPF链路状态路由,动态路由」配置OSPF宣告直连网路(config)#router ospf <进程号>(config-router)#router-id <任意ip地址>(config-router)#network <反掩码> area n重启OSPF进程#clear ip ospf process查看接口的OSPF信息#show ip ospf interface查看邻居表#show ip ospf neighbor查看链路数据表#show ip ospf database 「EIGRP链路状态路由,动态路由」配置EIGRP宣告直连网路(config)#router eigrp <系统编号>(config-router)#network 查看邻居表#show ip eigrp neighbors 查看拓扑表#show ip eigrp topology「VRRP虚拟路由器路由协议」提供网关冗余查看VRRP信息#show vrrp VRRP配置(在提供备份的两台路由器上做以下配置)端口跟踪(监视某个接口的状态)(config)#track 1 interface 接口line-protocol(config-if)#vrrp <1~254> ip 额外配置优先级(IP和优先级越大Master)和抢占(config-if)#vrrp <1~254> priority <1~254>(config-if)#vrrp <1~254> preempt(config-if)#vrrp 1 track 1 decrement <1~255> 「访问控制列表ACL」ACL无法控制自身发起的流量,对于已经建立的流量不起作用标准ACL(不能单独删除、添加一条访问列表)(config)#access-list <1~99|1300~1999> {permit|deny} ip地址反掩码扩展ACL(config)#access-list <100-199> {permit|deny} <协议> <源ip> <反掩码> <源端口> <目标ip> <反掩码> <目标端口>应用到指定ACL到某个接口(config)#int 接口(config-if)#ip access-group <1~99|100-199|1300~1999> {in|out}命名ACL(config)#ip access-list standard <标准ACL名字>(config-std-nacl)#{permit|deny} ip地址反掩码(config)#ip access-list extended <扩展ACL名字>(config-ext-nacl)#{permit|deny} <协议> <源ip> <反掩码> <源端口> <目标ip> <反掩码> <目标端口>应用到指定ACL到某个接口(config)#int 接口(config-if)#ip access-group <标准ACL名字|扩展ACL名字> {in|out}自反ACL(RACL,可以只允许内网主动发起的流量通过)(config)#ip access-list extended OUTB(config-ext-nacl)#permit tcp any any reflect RACL(config)#ip access-list extended INB(config-ext-nacl)#evaluate RACL(config-ext-nacl)#deny ip any any应用到指定ACL到某个接口(config-if)#ip access-group OUTB out(config-if)#ip access-group INB in 基于时间的ACL设置时区时间(config)#clock timezone GMT +8 #clock set hh:mm:ss <日> <月> <年>定义时间(config)#time-range <时间名>(config-time-range)#periodic hh:mm to hh:mm(config-time-range)#absolute start hh:mm:ss <日> <月> <年> end hh:mm:ss <日> <月> <年>结合ACL(config)#ip access-list extended <扩展ACL名字>(config-ext-nacl)#deny tcp any any time-range <时间名>「NAT和PAT」定义内外网接口(config)#int 接口(config-if)#ip nat {inside|outside}静态NAT(config)#ip nat inside source static ip地址静态PAT(config)#ip nat inside source static <协议> ip地址 <端口号>使用ACL捕获流量(config)#access-list n permit ip地址反掩码(config)#ip nat pool <地址池名> <起始ip地址> <终止ip地址> netmask 掩码TCP负载均衡(轮询转换)(config)#ip nat pool <地址池名> <起始ip地址> <终止ip地址> netmask 掩码type rotary动态NAT(config)#ip nat inside source list n pool <地址池名>动态PAT(config)#ip nat inside source list n pool <地址池名> overload查看转换项#show ip nat translations「广域网PPP协议」在串行口上的两台路由器都封装ppp协议(config)#int sx/x(config-if)#encapsulation ppp(config-if)#no shut 启用PAP认证,未加密认证方(config)#username <用户名>password <密码>(config-if)#ppp authentication pap请求认证方(config-if)#ppp pap sent-username <用户名> password <密码> 启用CHAP认证,安全加密认证方(config)#username <请求认证方名> password <请求认证方密码>(config-if)#ppp authentication chap请求认证方(config)#username <认证方名> password <认证方密码>(config-if)#ppp authentication chap 「帧中继」无广播的多路访问网络(NBMA)配置帧中继交换机关闭路由器路由功能(config)#no ip routing启用帧中继(config)#frame-relay switching进入串行接口R8(config)#int sx/x封装frame-relay协议R8(config-if)#encapsulation frame-relay指定lmi-type类型(config-if)#frame-relay lmi-type cisco指定intf-type接口类型为DCE(config-if)#frame-relay intf-type dce配置时钟频率(config-if)#clock rate n配置DLCI(config-if)#frame-relay route <进DLCI 号> int <出接口> <出DLCI号>配置路由器,封装frame-relay协议(config-if)#encapsulation frame-relay静态指定映射(config-if)#frame-relay map ip 清除动态学到的Frame Relay #clear frame-relay-inarp查看映射#show frame-relay map调试#debug frame-relay lmi点到多点(解决水平分割问题,划分子接口)适用于全互联和部分互联(config)#int sx/x(config-if)#encapsulation frame-relay(config)#int sx/x.x multipoint关闭反向arp,禁止自学习DLCI号和IP对应,而采取静态Map(config-subif)#no frame-relay inverse-arp静态映射DLCI号和IP(config-subif)#frame-relay map ip broadcast如在R1上对R3 DLCI号103 IP地址192.168.1.3点到点子接口(不存在水平分割问题)子接口可以看作是专线,适用于星型(config)#int sx/x(config-if)#encapsulation frame-relay(config)#int sx/x.x point-to-point(config-subif)#frame-relay interface-dlci以上就是店铺带给大家不一样的精彩。

华为路由器交换机配置命令大全

华为路由器交换机配置命令大全

华为路由器交换机配置命令大全华为路由器交换机配置命令大全一、登录与认证命令1.Telnet 登录命令2.SSH 登录命令3.Console 登录命令4.用户认证命令二、设备管理命令1.设备信息查看命令2.设备参数配置命令3.设备重启命令4.设备保存配置命令三、接口配置命令1.查看接口状态命令2.配置接口描述命令3.配置接口IP地质命令4.配置接口MTU命令5.开启/关闭接口命令四、路由配置命令1.配置静态路由命令2.配置默认路由命令3.配置动态路由命令4.查看路由表命令5.清空路由表命令五、VLAN 配置命令1.配置VLAN命令2.配置端口VLAN命令3.配置VLAN接口命令六、交换机功能配置命令1.配置端口镜像命令2.配置链路聚合命令3.配置交换机端口安全命令4.配置交换机QoS命令七、安全配置命令1.配置访问控制列表命令2.配置NAT命令3.配置防火墙命令4.配置SSL VPN命令附录:附件:1.示例配置文件2.常见问题解答法律名词及注释:1.Telnet:一种远程登录协议,用于远程连接路由器或交换机进行管理和配置。

2.SSH:Secure Shell,一种用于远程登录的网络协议,提供安全的数据通信和用户认证方式。

3.Console:一种通过串口连接设备进行本地登录的方式。

4.VLAN:Virtual Local Area Network,虚拟局域网,将不同的物理分组划分到不同的逻辑分组中,实现逻辑分离。

5.MTU:Maximum Transmission Unit,最大传输单元,指数据链路层上一次发送的帧的最大长度。

6.NAT:Network Address Translation,网络地质转换,用于在私有网络和公共网络之间进行通信的转换技术。

7.QoS:Quality of Service,服务质量,用于在网络通信中对不同数据流进行优先级和带宽控制。

交换机路由器命令

交换机路由器命令
1005 trnet-default act/unsup
交换机之间trunk
s3550(config-if)#switchport trunk encapsulation dot1q(三层)
s3550(config-if)#switchport mode trunk
S2126(config-if)#switchport mode trunk(二层交换机直接)
Router(config-if)#end(直接回到特权模式,而exit是向上一级一级的退)
Router#
四、
路由器:
Router#show ip route(显示路由表信息)
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
s2126(config-vlan)#exit
s2126(config)#exit
s2126#
s2126#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
Gateway of last resort is not set
C 192.168.50.0/24 is directly connected, FastEthernet0/0
Router(config)#hostname RC(路由器重新命名)
RC(config)#
RC(config)#ip route 65.154.12.0 255.255.255.0 202.98.1.2(静态路由表中,增加一条路由记录,如果要删除,则用no ip route65.154.12.0 255.255.255.0 202.98.1.2)

交换机和路由器配置命令

交换机和路由器配置命令

1.交换机支持的命令:交换机基本状态:switch: ;ROM状态,路由器是rommon> hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xx switch#exit ;返回命令交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain ;设置发vtp域名switch(config)#vtp password ;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address ;设置IP地址switch(config)#ip default-gateway ;设置默认网关switch#dir flash: ;查看闪存交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息2. 路由器支持的命令:路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname ;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xx router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address ;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address ;设置子接口IProuter(config-subif.1)#encapsulation dot1q ;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset ;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IPrommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS静态路由:ip route ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。

交换机路由器命令大全(结合配置实例)

交换机路由器命令大全(结合配置实例)

交换机路由器命令大全(结合配置实例)交换机路由器命令大全(结合配置实例)交换机和路由器是计算机网络中常用的网络设备,用于实现数据包的转发和路由选择。

在实际应用中,我们需要使用命令来配置交换机和路由器的各项参数。

本文将给出交换机和路由器常用命令的大全,并结合实际配置示例进行说明。

一、交换机命令1. 查看交换机基本信息查看交换机型号、固件版本、序列号等基本信息:show version2. 配置交换机端口设置交换机接口的速率、全双工模式等参数:interface interface_namespeed speed_valueduplex {full | half}3. 查看交换机端口状态查看交换机端口的连接状态、速率、工作模式等信息:show interfaces status4. 配置交换机VLAN创建VLAN和端口关联,实现VLAN的隔离和管理:vlan vlan_idname vlan_nameinterface interface_name5. 查看交换机MAC表显示交换机学习到的MAC地址和对应的端口:show mac-address-table6. 配置交换机链路聚合将多个物理端口绑定为一个逻辑端口,提高带宽和冗余性:interface port-channel channel_numberdescription description_textswitchport mode trunk/access7. 交换机Spanning Tree配置配置交换机的Spanning Tree协议参数,避免网络环路:spanning-tree vlan vlan_idpriority priority_value二、路由器命令1. 查看路由表显示路由器的路由表,包括直连路由、静态路由和动态路由表项:show ip route2. 配置静态路由手动配置路由器的静态路由表,指定目的网络和下一跳信息:ip route destination_network subnet_mask next_hop_ip3. 配置路由器接口配置路由器的接口参数,包括IP地址、子网掩码、描述等:interface interface_nameip address ip_address subnet_maskdescription description_text4. 配置路由器OSPF协议配置路由器之间的OSPF动态路由协议,实现网络的动态路由选择:router ospf process_idnetwork network_address wildcard_mask area area_number5. 配置路由器ACL配置路由器的访问控制列表,用于控制数据包的流量:access-list access_list_number permit/deny source destination6. 配置路由器NAT配置路由器的网络地址转换功能,实现内网与外网的互通:interface interface_nameip nat inside/outside三、配置实例1. 配置交换机端口接口GigabitEthernet0/1配置为100Mbps全双工模式:interface GigabitEthernet0/1speed 100duplex full2. 配置交换机VLAN创建VLAN10,将接口GigabitEthernet0/1划分到VLAN10:vlan 10name VLAN10interface GigabitEthernet0/13. 配置路由器接口将接口GigabitEthernet0/0配置为192.168.1.1/24的IP地址:interface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0description LAN interface4. 配置静态路由配置路由器的静态路由表,将目的网络192.168.2.0/24指向下一跳192.168.1.2:ip route 192.168.2.0 255.255.255.0 192.168.1.25. 配置路由器ACL设置访问控制列表,允许源IP地址为192.168.1.0/24的流量通过:access-list 1 permit 192.168.1.0 0.0.0.2556. 配置路由器NAT设置路由器的NAT,将内部接口GigabitEthernet0/1地址转换为公网地址:interface GigabitEthernet0/1ip nat inside以上是交换机和路由器常用命令的大全以及配置实例。

H3C路由器交换机配置命令

H3C路由器交换机配置命令

H3C路由器交换机配置命令H3C路由器交换机配置命令大全H3C路由器交换机怎么配置?配置命令有哪些?下面一起来看看最新H3C路由器交换机配置命令详解吧!交换机命令[Quidway]super password ;修改特权用户密码[Quidway]sysname ;交换机命名[Quidway]interface ethernet 0/1 ;进入接口视图[Quidway]interface vlan x ;进入接口视图[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 ;配置VLAN的IP地址[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 ;静态路由=网关[Quidway]user-interface vty 0 4 ;进入虚拟终端[S3026-ui-vty0-4]authentication-mode password ;设置口令模式[S3026-ui-vty0-4]set authentication-mode password simple 222 ;设置口令[S3026-ui-vty0-4]user privilege level 3 ;用户级别[Quidway-Ethernet0/1]duplex {half|full|auto} ;配置端口工作状态[Quidway-Ethernet0/1]speed {10|100|auto} ;配置端口工作速率[Quidway-Ethernet0/1]flow-control ;配置端口流控[Quidway-Ethernet0/1]mdi {across|auto|normal} ;配置端口平接扭接[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} ;设置端口工作模式[Quidway-Ethernet0/1]undo shutdown ;激活端口[Quidway-Ethernet0/2]quit ;退出系统视图[Quidway]vlan 3 ;创建VLAN[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 ;在VLAN中增加端口[Quidway-Ethernet0/2]port access vlan 3 ;当前端口加入到VLAN[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} ;设trunk允许的VLAN[Quidway-Ethernet0/2]port trunk pvid vlan 3 ;设置trunk端口的PVID[Quidway]monitor-port ;指定镜像端口[Quidway]port mirror ;指定被镜像端口[Quidway]port mirror int_list observing-port int_type int_num ;指定镜像和被镜像[Quidway]description string ;指定VLAN描述字符[Quidway]description ;删除VLAN描述字符[Quidway]display vlan [vlan_id] ;查看VLAN设置[Quidway]stp {enable|disable} ;设置生成树,默认关闭[Quidway]stp priority 4096 ;设置交换机的优先级[Quidway]stp root {primary|secondary} ;设置为根或根的备份[Quidway-Ethernet0/1]stp cost 200 ;设置交换机端口的花费[SwitchA-vlanx]isolate-user-vlan enable ;设置主vlan[SwitchA]Isolate-user-vlan secondary ;设置主vlan 包括的'子vlan[Quidway-Ethernet0/2]port hybrid pvid vlan ;设置vlan的pvid[Quidway-Ethernet0/2]port hybrid pvid ;删除vlan的pvid[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged ;设置无标识的vlan如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。

交换机路由器的基本命令

交换机路由器的基本命令

交换机和路由器是网络中的关键设备,它们有不同的功能和配置命令。

下面是一些基本的命令,用于配置和管理交换机和路由器:### 交换机基本命令:1. 进入特权模式:```enable```2. 进入全局配置模式:```configure terminal```3. 为接口配置VLAN:```interface FastEthernet0/1switchport mode accessswitchport access vlan 10```4. 显示交换机端口状态:```show interfaces status```5. 为交换机配置IP地址:```interface Vlan1ip address 192.168.1.1 255.255.255.0 ```6. 保存配置:```copy running-config startup-config ```### 路由器基本命令:1. 进入特权模式:```enable```2. 进入全局配置模式:```configure terminal```3. 为接口配置IP地址:```interface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0 ```4. 启用路由协议(如静态路由):```ip route 0.0.0.0 0.0.0.0 192.168.1.254 ```5. 查看路由表:```show ip route```6. 保存配置:```copy running-config startup-config```这些只是基本命令,实际的配置和管理可能会更加复杂,取决于网络需求和设备型号。

在实际应用中,您可能需要查阅特定设备的文档以获取更详细的命令和配置指南。

交换机和路由器的基本配置命令

交换机和路由器的基本配置命令

使用的是cisco网络设备操作系统命令,其他厂商设备应该相差不远,实验使用的设备时cisco catalyst1912交换机和cisco 2621路由器。

终端的IP配置命令:Ipconfig /ip IP地址子网掩码;Ipconfig /dg 网关IP常用的交换机的配置命令:交换机工作在OSI 模型的第二层(数据链路层), 地址学习, 转发过滤, 消除循环是交换机的三个主要功能。

有三种模式,“>”用户模式,“#”特权模式,“(CONFIG)#”全局模式.从用户模式进入特权模式:enable从特权模式进入全局模式:configure terminal,在特权模式下输入disable或者exit 回到用户模式,其他模式类似。

从全局模式进入端口模式:interface e0/1。

switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态用户模式(>)下:可以查看一些基本的配置信息。

特权模式(#)下:show ip 查看交换机的IP地址。

Show interface 查看所有端口的配置信息show interfaces Ethernet 0/1 查看E0/1口的信息Show interface e0/1 查看e0/1端口的配置信息。

show version 查看系统硬件的配置,软件版本号等。

show port ;(CatOS)显示每个端口的简要信息(号、VLAN、双工、…)show interface ;(IOS)show trunk ;(CatOS)显示中继信息(模式、封装、允许端口、剪裁、…)show interface trunk ;(IOS)show spantree 45 ;(CatOS)显示端口的STP模式、类型、状态、速端口、…) show spanning-tree 45 ;(IOS)Show running-config (show running也可以)查看当前正在运行的配置信息全局模式//配置模式((config)#):设置交换机名:hostname[交换机名]如:hostname switch1设置交换机的IP地址:ip address [ip address ][netmask]如ip address 172.16.0.1 255.255.0.0设置交换机的缺省网关:ip default-gatway [ip address]如:ip default-gatway 172.16.0.1设置密码enable password level [1-15] [passwork]1-15 表示级别,1表示设置登录时的密码,15设置进入全局模式的密码。

交换机路由器配置基本命令

交换机路由器配置基本命令
(1) 步骤1:
在全局配置模式中创建VLAN,如下:
S1(config)#vlan 2
S1(config-vlan)#name VLAN2
S1(config-vlan)#exit
S1(config)#vlan 3
S1(config-vlan)#name VLAN3
(2)步骤2:把端口划分在VLAN 中
S1(config)#interface f0/2
S1(config-if)#switch mode access
S1(config-if)#switch access vlan 3
【提示】默认时,所有交换机接口都在VLAN 1 上, 1 是不能删除的。如果有多个接口
需要划分到同一VLAN 下,也可以采用如下方式以节约时间,注意破折号前后的空格:
S1(config)#interface f0/1
S1(config-if)#switch mode access
//以上把交换机端口的模式改为access 模式,说明该端口是用于连接计算机的,而不是用
于trunk
S1(config-if)#switch access vlan 2
//然后把该端口f0/1 划分到VLAN 2 中
S1(config)#interface range f0/2 -3
S1(config-if)#switch mode access
S1(config-if)#switch access vlan 2
【提示】如果要删除VLAN,使用 “no vlan 2”命令即可。删除某一VLAN后,要记得把该VLAN
上的端口重新划分到别的VLAN上,否则将导致端口的“消失”。

路由器与交换机的配置代码

路由器与交换机的配置代码

1.配置路由器的主机名和提示信息。

Router(config)#Router(config)#hostname R1R1(config)#banner motd %Enter TEXT message. End with the character '%'.2.配置enable密码、配置console和vty密码。

R1(config)#enable secret classR1(config)#line console 0R1(config-line)#password ciscoR1(config-line)#loginR1(config-line)#line vty 0 4R1(config-line)#password ciscoR1(config-line)#login3.配置接口(s0/0和f0/0),并显示接口信息。

R1(config)#interface FastEthernet0/0R1(config-if)#ip address 192.168.10.1 255.255.255.0R1(config-if)#no shutdown保存配置R1#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]删除启动配置R1#erase startup-configErasing the nvram filesystem will remove all configuration files! Continue? [confirm] [OK]Erase of nvram: complete%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram查看R1的cdp邻居R1#show cdp neighbors关闭R1接口下的cdpR1(config)#interface s0/0/0R1(config-if)#no cdp enable打开R1接口下的cdpR1(config)#interface s0/0/0R1(config-if)#cdp enableble4)关闭和打开整个路由的cdp关闭R1整个路由的cdpR1(config)#no cdp run打开R1整个路由的cdpR1(config)#cdp run关闭R2整个路由的cdpR2(config)#no cdp run打开R2整个路由的cdpR2(config)#cdp run5)在R1和R2上的s0/0上配置IP地址,以及enable密码和vty密码对R1进行配置R1(config)#interface s0/0/0R1(config-if)#ip address 192.168.1.1 255.255.255.0R1(config-if)#no shutdownR1(config)#enable secret classR1(config-line)#line vty 0 4R1(config-line)#password ciscoR1(config-line)#loginWrite)4)把IOS从路由器备份到TFTP服务器上。

交换机与路由器配置

交换机与路由器配置

路由器与交换机配置一、交换机的基本配置1.配置enable口令、密码和主机名Switch>(用户执行模式提示符)Switch>enable(进入特权模式)Switch#(特权模式提示符)Switch#config terminal(进入配置模式)Switch(config)#enable password cisco(设置enable password为cisco) Switch(config)#enable secret cisco1(设置enable secret为sisco1) Switch(config)#hostname C2950(设置主机名为C2950)C2950(config)#end(退回到特权模式)C2950#2.配置交换机IP地址、默认网关、域名和域名服务器C2950(config)#ip address192.168.1.1255.255.255.0(设置交换机IP) C2950(config)#ip default-gateway192.168.1.254(设置默认网关) C2950(config)#ip domain-name (设置域名)C2950(config)#ip name-server200.0.0.1(设置域名服务器)C2950(config)#end3.配置交换机的端口属性C2950(config)#interface fastethernet0/1(进入接口0/1的配置模式) C2950(config-if)#speed?(查看speed命令的子命令)C2950(config-if)#speed100(设置该端口速率为100Mbps)C2950(config-if)#duplex?(查看duplex命令的子命令)C2950(config-if)#duplex full(设置该端口为全双工)C2950(config-if)#description TO_PC1(设置该端口描述为TO_PC1) C2950(config-if)#^Z(返回到特权模式,同end)C2950#show interface fastethernet0/1(查看端口0/1的配置结果) C2950#show interface fastethernet0/1status(查看端口0/1的状态) 4.配置和查看MAC地址表C2950(config)#mac-address-table?(查看mac-address-table的子命令)C2950(config)#mac-address-table aging-time100(设置超时时间为100s)C2950(config)#mac-address-table permanent0000.0c01.bbcc f0/3(加入永久地址)C2950(config)#mac-address-table restricted static0000.0c02.bbcc f0/3f0/7(加入静态地址)C2950(config)#endC2950#show mac-address-table(查看整个MAC地址表)C2950#clear mac-address-table restricted static(清除限制性地址)二、配置和管理VLAN1.VLAN基础知识VLAN技术:把物理上直接相连的网络从逻辑上划分为多个子网。

路由器和交换机命令大全

路由器和交换机命令大全

路由器和交换机命令大全路由器和交换机是计算机网络中常用的设备,它们在数据传输和网络管理中发挥着重要的作用。

掌握路由器和交换机的命令是网络管理和故障排除的基本要求。

本文将为您提供常见的路由器和交换机命令大全,以帮助您更好地理解和应用这些设备。

一、路由器命令1. show ip route:显示路由表中的所有路由信息。

2. show interfaces:显示接口的状态和统计信息。

3. show running-config:显示当前路由器的配置信息。

4. show version:显示路由器的硬件和软件版本信息。

5. configure terminal:进入全局配置模式。

6. interface interface-name:进入指定接口的配置模式。

7. ip address ip-address subnet-mask:为接口配置IP地址和子网掩码。

8. ip route destination-network subnet-mask next-hop:配置静态路由。

9. access-list access-list-number {deny | permit} source destination:配置访问控制列表。

10. clear arp-cache:清除路由器的ARP缓存。

11. debug {protocols | ip | interface}:启用某个调试功能来监控网络流量或接口状态。

二、交换机命令1. show interfaces:显示接口的状态和统计信息。

2. show mac-address-table:显示交换机的MAC地址表。

3. show running-config:显示当前交换机的配置信息。

4. show vlan:显示交换机的VLAN信息。

5. configure terminal:进入全局配置模式。

6. interface interface-name:进入指定接口的配置模式。

华为路由器、交换机配置命令大全

华为路由器、交换机配置命令大全

华为路由器、交换机配置命令大全华为路由器配置命令大全:一、登录华为路由器控制台1:使用PuTTY或其他SSH客户端登录到华为路由器:```ssh admin<路由器IP地址>```2:输入登录密码进行验证。

二、基本配置命令1:设置主机名:```sysname <主机名>```2:配置管理接口:```interface GigabitEthernet0/0/0ip address <IP地址> <子网掩码>```3:配置VLAN接口:```interface Vlanif <VLAN ID>ip address <IP地址> <子网掩码>```三、路由相关配置命令1:静态路由配置:```ip route-static <目标网络> <子网掩码> <下一跳地址> ```2:动态路由配置:```router ospf <进程ID>router-id <路由器ID>network <网络地址> <子网掩码> area <区域ID>3: BGP路由配置:```bgp <AS号码>router-id <路由器ID>peer <对端IP地址> as-number <对端AS号码>```四、安全配置命令1:配置防火墙规则:```acl number <ACL编号>rule <规则序号> permit source <源地址> destination <目的地址>rule <规则序号> deny source <源地址> destination <目的地址>```2:开启SSH服务:ssh server enable```3:配置AAA认证:```aaalocal-user <用户名> password irreversible-cipher <加密密码>authorization-attribute user-role network-admin```五、NAT配置命令1:配置静态NAT:```interface GigabitEthernet0/0/0nat outbound <内部接口> <外部接口>```2:配置动态NAT:nat address-group <地址组名>address <内部地址> <外部地址>```3:配置PAT:```interface GigabitEthernet0/0/0nat address-group <地址组名>```附件:1:示例配置文件(附件1)2:路由器接口图(附件2)法律名词及注释:1:主机名:路由器的标识名称。

交换机与路由器的配置

交换机与路由器的配置

交换机与路由器的配置交换机与路由器的配置:一、前言本文档旨在介绍交换机和路由器的配置步骤,包括基本设置、接口配置、VLAN配置、静态路由配置等内容。

二、基本设置在配置交换机和路由器之前,需要进行基本设置,如设定管理IP地质、设置管理员密码、启用远程管理等。

以下是基本设置的步骤:1.进入设备终端,使用管理员权限登录。

2.设置设备的管理IP地质。

可以使用以下命令进行配置:ip address <IP地质> <子网掩码>3.设置管理员密码,以保护设备的管理权限。

以下是设置管理员密码的命令示例:enable password <密码>4.启用远程管理,以方便从远程位置对设备进行管理。

可以使用以下命令进行配置:line vty 0 15logintransport input telnet sshexit三、接口配置接口配置是指对交换机和路由器的物理接口进行设置,包括端口速率、双工模式、带宽控制等。

以下是接口配置的步骤:1.进入设备终端,使用管理员权限登录。

2.进入接口配置模式。

可以使用以下命令进入接口配置模式:interface <接口名称>3.配置接口的速率和双工模式。

以下是配置接口速率和双工模式的命令示例:speed <速率>duplex <双工模式>4.设置接口的带宽控制,以控制接口的传输速率。

以下是设置带宽控制的命令示例:bandwidth <带宽大小>四、VLAN配置VLAN配置是指对交换机进行虚拟局域网的划分和配置。

以下是VLAN配置的步骤:1.进入设备终端,使用管理员权限登录。

2.进入VLAN配置模式。

可以使用以下命令进入VLAN配置模式:vlan database3.创建VLAN。

以下是创建VLAN的命令示例:vlan <VLAN编号> name <VLAN名称>4.配置接口的VLAN成员关系。

路由器和交换机的配置命令的简写

路由器和交换机的配置命令的简写

那可多了~Cisco路由配置语句汇总启动接口,分配IP地址:router>router> enablerouter#router# configure terminalrouter(config)#router(config)# interface Type Portrouter(config-if)# no shutdownrouter(config-if)# ip address IP-Address Subnet-Maskrouter(config-if)# ^z配置RIP路由协议:30秒更新一次router(config)# router riprouter(config-if)# network Network-Number <——通告标准A,B,C类网——>router(config-if)# ^z配置IGRP路由协议:90秒更新一次router(config)# router igrp AS-Number <—— AS-Number范围1~65535——>router(config-if)# network Network-Number <——通告标准A,B,C类网——>router(config-if)# ^z配置Novell IPX路由协议:Novell RIP 60秒更新一次router(config)# ipx routing [node address]router(config)# ipx maximum-paths Paths <——设置负载平衡,范围1~512——>router(config)# interface Type Portrouter(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] <——通告标准A,B,C类网——>router(config-if)# ^z配置DDR:router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number]router(config)# interface bri 0router(config-if)# dialer-group Group-Numberrouter(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Numberrouter(config-if)# ^z配置ISDN:router(config)# isdnth-typeth-Type <——配置ISDN交换机类型,中国使用basic-net3——>router(config-if)# ^z配置Frame Relay:router(config-if)# encapsulation frame-relay [cisco | ietf ]router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ]router(config-if)# bandwidth kilobitsrouter(config-if)# frame-relay invers-arp [ Protocol ] [dlci ]<——配置静态Invers ARP表:router(config)# frame-relay Protocol Protocol-Address DLCI [ Broadcast ] [ ietf | cisco ] [ payload-compress | packet-by-packet ]——><——设置Keepalive间隔:router(config-if)# keepalive Number——><——为本地接口指定DLCI:router(config-if)# frame-lelay local-dlci Number——><——子接口配置:router(config-if)# interface Type Port.Subininterface-Number [ multipoint | point-to-point ]router(config-subif)# ip unnumbered Interfacerouter(config-subif)# frame-lelay local-dlci Number——>router(config-if)# ^z配置标准ACL:router(config)# access-list Access-List-Number [ permit | deny ] source [ source-mask ] <——Access-List-Number 范围:1~99标准ACL;100~199扩展ACL;800~899标准IPX ACL;900~999扩展IPX ACL;1000~1099 IPX SAP ACL;600~699Apple Talk ACL——>router(config)# interface Type Portrouter(config-if)# ip access-group Access-List-Number [ in | out ]router(config-if)# ^z配置扩展ACL:router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]router(config)# interface Type Portrouter(config-if)# ip access-group Access-List-Number [ in | out ]router(config-if)# ^z配置命名ACL:router(config)# ip access-list [ standard | extended ] ACL-Namerouter(config [ std- | ext- ] nacl)# [ permit | deny ] [ IP-Access-List-Test-Conditions ]router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ IP-Access-List-Test-Conditions ]router(config [ std- | ext- ] nacl)# ^zrouter(config)# interface Type Portrouter(config-if)# ip access-group [ACL-Name | 1~199 ] [ in | out ]router(config-if)# ^zywELinux联盟配置DCE时钟:router# show controllers Type Port <——确定DCE接口——>router(confin-if)# clock rate 64000 <——进入DCE接口设置时钟速率——>router(config-if)# ^z配置PPP协议:router(config)# username Name password Set-Password-Here <——验证方建立数据库——>router(config)# interface Type Portrouter(config-if)# encapsulation ppp <——启动PPP协议——>router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <——选择PPP认证——>router(config-if)# ppp pap sent-username Name password Password <——发送验证信息——>router(config-if)# ^zPAP单向认证配置实例:验证方:router-server(config)# username Client password 12345 <——验证方建立数据库——>router-server(config)# interface serial 0router-server(config-if)# encapsulation ppprouter-server(config-if)# ppp authentication pap <——选择使用PAP实现PPP认证——>router-server(config-if)# ^z被验证方:router-client(config-if)# encapsulation ppprouter-client(config-if)# ppp pap sent-username Client password 12345 <——发送验证信息——>router-client(config-if)# ^zywELinux联盟PAP双向认证配置实例:路由器 A:routerA(config)# username B password 12345routerA(config)# interface serial 0routerA(config-if)# encapsulation ppprouterA(config-if)# ppp authentication paprouterA(config-if)# ppp pap sent-username A password 54321routerA(config-if)# ^z路由器 B:routerB(config)# username A password 54321routerB(config)# interface serial 1routerB(config-if)# encapsulation ppprouterB(config-if)# ppp authentication paprouterB(config-if)# ppp pap sent-username B password 12345 routerB(config-if)# ^zCHAP单向认证配置实例:验证方:router-server(config)# username router-client password 12345 router-server(config)# interface serial 0router-server(config-if)# encapsulation ppprouter-server(config-if)# ppp authentication chaprouter-server(config-if)# ^z被验证方:router-client(config-if)# encapsulation ppprouter-client(config-if)# ppp authentication chaprouter-client(config-if)# ppp chap hostname router-client router-client(config-if)# ppp chap password 12345router-client(config-if)# ^z CHAP双向认证配置实例:路由器 A:routerA(config)# username routerB password 12345routerA(config)# interface serial 0routerA(config-if)# encapsulation ppprouterA(config-if)# ppp authentication chaprouterA(config-if)# ppp chap hostname routerArouterA(config-if)# ppp chap password 54321routerA(config-if)# ^z路由器 B:routerB(config)# username routerA password 54321routerB(config)# interface serial 1routerB(config-if)# encapsulation ppprouterB(config-if)# ppp authentication chaprouterB(config-if)# ppp chap hostname routerBrouterB(config-if)# ppp chap password 12345routerB(config-if)# ^zywELinux联盟Telnet使用:routerA# terminal monitor <——可以传回在远端主机执行Debug命令的结果——>routerA# telnet IP-Address [ Router-Name ] <——Telnet到指定的地址或名字的主机——> routerB# [ exit | logout ] <——退出Telnet——>routerB# ++<6>再按 <——挂起Telnet——>routerA# show sessions <——显示当前所有Telnet的信息,包括Connect-Number ——>routerA# Connect-Number <——返回指定的Telnet连接——>routerA# disconnect IP-Address [ Router-Name ] <——断开指定地址或名字的主机的连接——> routerA# show user <——显示Telnet到本机的连接信息——>routerA# clear line [ 0 | 1 | 2 | 3 | 4 ] <——断开指定Telnet到本机的连接——>禁止任何Telnet到本机:router(config)# line vty 0 4router(config-line)# access-class ACL-Numberrouter(config)# ^z设置主机名:router(config)# hostname Set-Hostnamerouter(config)# ^zrouter(config)# ^z设置用户模式密码:router(config)# line console 0router(config-line)# loginrouter(config-line)# password Set-Passwordrouter(config-line)# ^zywELinux联盟设置Telnet密码:router(config)# line vty 0 4router(config-line)# loginrouter(config-line)# password Set-Passwordrouter(config-line)# ^z设置特权模式密码:router(config)# enable password Set-Password <——不加密的密码,明码——>router(config)# enable secret Set-Password <——经过加密的密码——>router(config)# ^z给所有密码加密:router(config)# service password-ancryption Set-Password-Hererouter(config)# no service password-ancryption <——取消加密——>router(config)# ^z设置登录Banner:router(config)# banner motd 分隔符 Set-Banner-InFORMation-Here 分隔符 <——前后分隔符一定要一致——>设置接口的描述信息:router(config-if)# description Set-Port-InFORMation-Hererouter(config)# ^zCDP的控制:router(config-if)# cdp enable <——在指定端口启用CDP,缺省——>router(config-if)# no cdp enable <——在指定端口关闭CDP——>router(config)# cdp run <——使所有端口启用CDP——>router(config)# no cdp run <——使所有端口关闭CDP——>Ping的使用:router# ping IP-Addressrouter# ping <——扩展Ping命令——>Protocol [ip]:[ Protocol-Type ] <——选择协议类型——>Target IP address:IP-Address <——输入测试地址——>Repeat count [5]: <——选择发送的ICMP包数量——>Datagram size [100]: <——选择每个包的大小——>Timeout in seconds [2]: <——设置每个包的超时时间——>Extended commands [n]:y <——使用扩展Ping命令——>Sweep range of sizes [n]:ywELinux联盟Tracke的使用:router# trace IP-Address [ Host-Name ]为Cisco 4000路由器指定媒体类型:router(config-if)# media-type 10baset <——使AUI(默认)失效,改为使用RJ-45——>router(config-if)# ^z更改路由器启动顺序:router(config)# boot system flash IOS-FileNamerouter(config)# boot system tftp IOS-FileName TFTP-IP-Addressrouter(config)# boot system romrouter(config)# ^z修改寄存器数值:router(config)# config-register value <——Cisco出厂默认value=0x2102,value范围:0x2100(进入ROM监视器),0x2101(使系统从ROM启动),0x2102~0x210F(使系统从NVRAM启动)。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

华为路由器交换机配置命令史上最全华为路由器交换机配置命令大合集,熟练掌握下面的华为路由器交换机配置知识点,你只需花几分钟的时间就能明白华为路由器交换机配置。

交换机的配置命令等等。

PCAlogin:root;使用root用户password:linux;口令是linux#shutdown-hnow;关机#init0;关机#logout;用户注销#login;用户登录#ifconfig;显示IP地址#ifconfigeth0netmask;设置IP地址#ifconfigeht0netmaskdown;禁用IP地址#routeadd0.0.0.0gw;设置网关#routedel0.0.0.0gw;删除网关#routeadddefaultgw;设置网关#routedeldefaultgw;删除网关#route;显示网关#ping;发ECHO包#telnet;远程登录华为路由器交换机配置命令:交换机命令<>变成【】sys[Quidway]dis cur;显示当前配置[Quidway]display current-configuration;显示当前配置[Quidway]display interfaces;显示接口信息[Quidway]display vlan all;显示路由信息[Quidway]display version;显示版本信息[Quidway]superpassword;修改特权用户密码[Quidway]sysname;交换机命名[Quidway]interface ethernet0/1;进入接口视图[Quidway]interface vlanx;进入接口视图[Quidway-Vlan-interfacex]ip address 10.65.1.1255.255.0.0;配置VLAN的IP地址[Quidway]iproute-static0.0.0.00.0.0.010.65.1.2;静态路由=网关[Quidway]rip;三层交换支持[Quidway]local-userftp[Quidway]user-interfacevty04;进入虚拟终端[S3026-ui-vty0-4]authentication-modepassword;设置口令模式[S3026-ui-vty0-4]setauthentication-modepasswordsimple222;设置口令[S3026-ui-vty0-4]userprivilegelevel3;用户级别[Quidway]interfaceethernet0/1;进入端口模式[Quidway]inte0/1;进入端口模式[Quidway-Ethernet0/1]duplex{half|full|auto};配置端口工作状态[Quidway-Ethernet0/1]speed{10|100|auto};配置端口工作速率[Quidway-Ethernet0/1]flow-control;配置端口流控[Quidway-Ethernet0/1]mdi{across|auto|normal};配置端口平接扭接[Quidway-Ethernet0/1]portlink-type{trunk|access|hybrid};设置端口工作模式[Quidway-Ethernet0/1]portaccessvlan3;当前端口加入到VLAN [Quidway-Ethernet0/2]porttrunkpermitvlan{ID|All};设trunk允许的VLAN [Quidway-Ethernet0/3]porttrunkpvidvlan3;设置trunk端口的PVID [Quidway-Ethernet0/1]undoshutdown;激活端口[Quidway-Ethernet0/1]shutdown;关闭端口[Quidway-Ethernet0/1]quit;返回[Quidway]vlan3;创建VLAN[Quidway-vlan3]portethernet0/1;在VLAN中增加端口[Quidway-vlan3]porte0/1;简写方式[Quidway-vlan3]portethernet0/1toethernet0/4;在VLAN中增加端口[Quidway-vlan3]porte0/1toe0/4;简写方式[Quidway]monitor-port;指定镜像端口[Quidway]portmirror;指定被镜像端口[Quidway]portmirrorint_listobserving-portint_typeint_num;指定镜像和被镜像[Quidway]descriptionstring;指定VLAN描述字符[Quidway]description;删除VLAN描述字符[Quidway]displayvlan[vlan_id];查看VLAN设置[Quidway]stp{enable|disable};设置生成树,默认关闭[Quidway]stppriority4096;设置交换机的优先级[Quidway]stproot{primary|secondary};设置为根或根的备份[Quidway-Ethernet0/1]stpcost200;设置交换机端口的花费[Quidway]link-aggregatione0/1toe0/4ingress|both;端口的聚合[Quidway]undolink-aggregatione0/1|all;始端口为通道号[SwitchA-vlanx]isolate-user-vlanenable;设置主vlan[SwitchA]isolate-user-vlansecondary;设置主vlan包括的子vlan [Quidway-Ethernet0/2]porthybridpvidvlan;设置vlan的pvid[Quidway-Ethernet0/2]porthybridpvid;删除vlan的pvid[Quidway-Ethernet0/2]porthybridvlanvlan_id_listuntagged;设置无标识的vlan 如果包的vlanid与PVId一致,则去掉vlan信息.默认PVID=1。

所以设置PVID为所属vlanid,设置可以互通的vlan为untagged.华为路由器交换机配置命令:路由器命令[Quidway]displayversion;显示版本信息[Quidway]displaycurrent-configuration;显示当前配置[Quidway]displayinterfaces;显示接口信息[Quidway]displayiproute;显示路由信息[Quidway]sysnameaabbcc;更改主机名[Quidway]superpasswrod123456;设置口令[Quidway]interfaceserial0;进入接口[Quidway-serial0]ipaddress;配置端口IP地址[Quidway-serial0]undoshutdown;激活端口[Quidway]link-protocolhdlc;绑定hdlc协议[Quidway]user-interfacevty04[Quidway-ui-vty0-4]authentication-modepassword[Quidway-ui-vty0-4]setauthentication-modepasswordsimple222 [Quidway-ui-vty0-4]userprivilegelevel3[Quidway-ui-vty0-4]quit[Quidway]debugginghdlcallserial0;显示所有信息[Quidway]debugginghdlceventserial0;调试事件信息[Quidway]debugginghdlcpacketserial0;显示包的信息华为路由器交换机配置命令:静态路由:[Quidway]iproute-static{interfacenumber|nexthop}[value][reject|blackhole] 例如:[Quidway]iproute-static129.1.0.01610.0.0.2[Quidway]iproute-static129.1.0.0255.255.0.010.0.0.2[Quidway]iproute-static129.1.0.016Serial2[Quidway]iproute-static0.0.0.00.0.0.010.0.0.2华为路由器交换机配置命令:动态路由:[Quidway]rip;设置动态路由[Quidway]ripwork;设置工作允许[Quidway]ripinput;设置入口允许[Quidway]ripoutput;设置出口允许[Quidway-rip]network1.0.0.0;设置交换路由网络[Quidway-rip]networkall;设置与所有网络交换[Quidway-rip]peerip-address;[Quidway-rip]summary;路由聚合[Quidway]ripversion1;设置工作在版本1[Quidway]ripversion2multicast;设版本2,多播方式[Quidway-Ethernet0]ripsplit-horizon;水平分隔[Quidway]routeridA.B.C.D;配置路由器的ID[Quidway]ospfenable;启动OSPF协议[Quidway-ospf]import-routedirect;引入直联路由[Quidway-Serial0]ospfenablearea;配置OSPF区域华为路由器交换机配置命令:标准访问列表命令格式如下:acl[match-orderconfig|auto];默认前者顺序匹配。

rule[normal|special]{permit|deny}[sourcesource-addrsource-wildcard|any] 例:[Quidway]acl10[Quidway-acl-10]rulenormalpermitsource10.0.0.00.0.0.255[Quidway-acl-10]rulenormaldenysourceany华为路由器交换机配置命令:扩展访问控制列表配置命令配置TCP/UDP协议的扩展访问列表:rule{normal|special}{permit|deny}{tcp|udp}source{|any}destination|any} [operate]配置ICMP协议的扩展访问列表:rule{normal|special}{permit|deny}icmpsource{|any]destination{|any] [icmp-code][logging]华为路由器交换机配置命令:扩展访问控制列表操作符的含义equalportnumber;等于greater-thanportnumber;大于less-thanportnumber;小于not-equalportnumber;不等rangeportnumber1portnumber2;区间华为路由器交换机配置命令:扩展访问控制列表举例[Quidway]acl101[Quidway-acl-101]ruledenysouceanydestinationany[Quidway-acl-101]rulepermiticmpsourceanydestinationanyicmp-typeecho[Quidway-acl-101]rulepermiticmpsourceanydestinationanyicmp-typeecho-reply [Quidway]acl102[Quidway-acl-102]rulepermitipsource10.0.0.10.0.0.0destination202.0.0.10.0.0.0 [Quidway-acl-102]ruledenyipsourceanydestinationany[Quidway]acl103[Quidway-acl-103]rulepermittcpsourceanydestination10.0.0.10.0.0.0destination-portequal ftp[Quidway-acl-103]rulepermittcpsourceanydestination10.0.0.20.0.0.0destination-portequal www[Quidway]firewallenable[Quidway]firewalldefaultpermit|deny[Quidway]inte0[Quidway-Ethernet0]firewallpacket-filter101inbound|outbound华为路由器交换机配置命令:地址转换配置举例[Quidway]firewallenable[Quidway]firewalldefaultpermit[Quidway]acl101;内部指定主机可以进入e0[Quidway-acl-101]ruledenyipsourceanydestinationany[Quidway-acl-101]rulepermitipsource129.38.1.10destinationany[Quidway-acl-101]rulepermitipsource129.38.1.20destinationany[Quidway-acl-101]rulepermitipsource129.38.1.30destinationany[Quidway-acl-101]rulepermitipsource129.38.1.40destinationany[Quidway-acl-101]quit[Quidway]inte0[Quidway-Ethernet0]firewallpacket-filter101inbound[Quidway]acl102;外部特定主机和大于1024端口的数据包允许进入S0[Quidway-acl-102]ruledenyipsourceanydestinationany[Quidway-acl-102]rulepermittcpsource202.39.2.30destination202.38.160.10[Quidway-acl-102]rulepermittcpsourceanydestination202.38.160.10destination-portgreat-t han1024[Quidway-acl-102]quit[Quidway]ints0[Quidway-Serial0]firewallpacket-filter102inbound;设202.38.160.1是路由器出口IP。

相关文档
最新文档