神州数码路由交换命令

神州数码路由交换命令

2023年7月4日发(作者:)

特别注意

交换机恢复出厂:set dfault write reload

firewall enable #全局开启firewall enable

firewall default {permit | deny} 设置防火墙默认动作

跟踪路由 tracert

Telnet,SSH远程登录

路由器

aaa authentication login default local

aaa authentication enable default enable

username abc password 123

enable password 0 123

line vty 0

login authentication default

交换机

Switch(config)# telnet-server enable

Switch(config)#username test privilege 15 password 0 test

Switch(config)#authentication line vty login local

authentication securityip 配置Telnet登录到交换机的安全IP地址

限制允许IP地址段Telnet登录交换机

switch(config)#access-list 1 permit 192.168.1.0 0.0.0.255

switch(config)#authentication ip access-class 1 in

Switch(config)#ssh-server enable

Switch(config)#username test privilege 15 password 0 test

Switch(config)#authentication line vty login local

Switch(config)#interface vlan 1

Switch(Config-if-Vlan1)#ip address 100.100.100.200 255.255.255.0

ssh-server timeout 设置SSH认证超时时间

ssh-server authentication-retries 设置SSH认证重试次数

switch(config)#ip http server

switch(config)#username test privilege 15 password 0 test switch(config)#authentication line web login local

switch(config)#ip http secure-server

DHCP

switch(config)#service dhcp

switch(config)#ip dhcp pool

vlan10

switch(dhcp-vlan10-config)#network 10.1.1.1 24

switch(dhcp-vlan10-config)#default-router 10.1.1.1

中继:

switch(config)#service dhcp

switch(config)#ip forward-protocol udp bootps

switch(config-Vlan20)#ip help-address

10.1.1.1

dhcp绑定,不允许手动配置ip地址

#全局开启DHCP Snooping和DHCP Snooping绑定功能

DHCP分配固定ip:

switch(config)#ip dhcp excluded-address 10.1.1.2 10.1.1.10 不自动分配地址池

switch(config)#ip dhcp pool

10

switch(dhcp-vlan10-config)#host 10.1.1.5

switch(dhcp-vlan10-config)#default-router 10.1.1.1

switch(dhcp-vlan10-config)#hardware-address 00-0B-4C-9E-2a -1C绑定硬件地址

#全局开启DHCP Snooping和DHCP Snooping绑定功能

switch(config)#ip dhcp snooping enable

switch(config)#ip dhcp snooping binding enable

switch(config)#interface ethernet 1/24

switch(Config-Ethernet1/24)#ip dhcp snooping trust

#设置E 1/1端口可以自动绑定DHCP获得的IP地址

switch(config)#interface ethernet 1/1

switch(Config-Ethernet1/1)#ip dhcp snooping binding user-control

switch(Config-Ethernet1/1)#exit

#手动绑定PC 1的IP地址和MAC地址

switch(config)#ip dhcp snooping binding user 00-11-11-11-11-11 address 10.1.1.2 mask

255.255.255.0 vlan 1 interface 1/2

路由器:

Router_config#ip dhcpd enable //启动DHCP 服务

Router_config#ip dhcpd pool 1

Router_config_dhcp#network 192.168.1.0 255.255.255.0

Router_config_dhcp#range 192.168.1.11 192.168.1.20

Router_config_dhcp#lease 1 //定义租期

Router_config_dhcp#dns-server 1.1.1.1 //定义DNS服务器地址

Router_config_dhcp#default-router 192.168.1.1

端口安全

Switchport port-security lock 锁定安全端口,使pc只能通过此端口通信

Switchport port-security convert 动态学习mac

Mac-address-table blackhole address aa-bb-cc-dd-ee-ff vlan 30 mac表过滤

端口操作

端口IP mac绑定

#全局打开AM功能

Switch(config)#am enable

#端口 1/1开启AM功能,绑定IP

Switch(config)#interface ethernet 1/1

Switch(config-If-Ethernet 1/1)#am port

Switch(config-If-Ethernet 1/1)#am ip-pool 1.1.1.2 2

Switch(config-If-Ethernet 1/1)#exit

#端口 1/2开户AM功能,绑定IP、MAC

Switch(config)#interface ethernet 1/2

Switch(config-If-Ethernet 1/2)#am port

Switch(config-If-Ethernet 1/2)#am mac-ip-pool 00-44-44-44-44-44 1.1.1.4

Switch(config-If-Ethernet 1/2)#exit

端口限速

Switch(config)#interface ethernet 1/1

Switch(Config-If-Ethernet1/1)#bandwidth control 10000 both 限速10MB

参数:both为端口收发时均进行带宽控制;receive为仅在端口接收数据时进行带宽控制;transmit为仅在端口发送数据时进行带宽控制。

rate-violation <200-2000000> 设置交换机端口的报文最大收包速率,如果端口的接收报文速率违背了收包速率则shutdown端口,可以配置shutdown端口后的恢复时间,默认是300s。

端口镜像

Monitor session 1 source interface e0/1 rx被复制端口的RX数据(RX(收)TX(发)both(所有))

Monitor session 1 destination interface e0/24 复制到端口,目地端口只能是1个端口 switch(config)#monitor session 1 reflector-port interface ethernet 1/3 镜像端口

端口隔离

#配置端口E 0/0/1和E 0/0/2属于隔离组test

Switch(config)#isolate-port group test

switchport interface ethernet 0/0/1-2

SW 3的配置

单端口环路检测

#全局配置单端口环路检测报文的发送间隔(有环路时120秒发送1次,没有环路时2秒发送1次)

switch(config)#loopback-detection interval-time 35 15

#端口打开单端口环路检测功能,控制模式为ShutDown

switch(config)#interface ethernet 1/1-24

switch(config-if-port-range)#loopback-detection special-vlan 1

switch(config-if-port-range)#loopback-detection control shutdown

switch(config-if-port-range)#exit

#全局打开单端口环路ShutDown自动恢复功能,恢复时间为300秒

switch(config)#loopback-detection control-recovery timeout 300

VRRP

交换机:

switch(config)#router vrrp 10

switch(config-router)#virtual-ip 192.168.10.254

switch(config-router)#priority 120

switch(config-router)#interface vlan 10

switch(config-router)#circuit-failover vlan 200 110 跟踪上联接口

switch(config-router)#enable

路由器:

RouterA_config#interface fastEthernet 0/0.2 !进入子端口F0/0.2

RouterA_config_f0/0.2#ip address 192.168.0.20 255.255.255.0 !配置F0/0.2子端口的IP

RouterA_config_f0/0.2#encapsulation dot1Q 2 !设置端口封装vlan 2(vlan 2 从这里过)

RouterA_config_f0/0.2#vrrp 2 associate 192.168.0.2 255.255.255.0 !配置VRRP 组 2 的虚拟IP

RouterA_config_f0/0.2#vrrp 2 priority 105 !配置VRRP 组 2 的优先级为105

RouterA_config_f0/0.2#vrrp 2 preempt(默认为抢占模式,不设置也行) !配置VRRP 组 2 为抢占模式

RouterA_config_f0/0.2#vrrp 2 track interface fastEthernet 0/3 10 !配置VRRP 组 2 跟踪外网接口F0/3 当外网接口中断时优先级减10

组播路由协议

路由

全局模式:Ip multicast-routing

端口下:ip dvmrp

交换

每个接口下应用:ip dvmrp enable

全局模式:ip dvmrp multicast-routing

每个接口下应用:ip pim multicast-routing

端口下:ip pim dense-mode

ACL

switch(config)#firewall enable #开局开户firewall enable

switch(config)#mac-access-list extended noaccess_00-03-0f-00-00-02 #创建ACL

switch(config-mac-ext-nacl-noaccess_00-03-0f-00-00-02)#deny host-source-mac 00-03-0f-00-00-01

host-destination-mac 00-03-0f-00-00-02 #拒绝MAC 00-03-0f-00-00-01 访问00-03-0f-00-00-02

switch(config-if-ethernet1/0/1)#mac access-group noaccess_00-03-0f-00-00-01 in #接口下调用

switch(config)#firewall enable #全局开启firewall enable

switch(config)#access-list 3222 deny 00-03-0f-00-00-01 00-00-00-00-00-ff

any-destination-mac tcp 192.168.1.0 0.0.0.255 any-destination d-port 23 #匹配网段、MAC、端口等

switch(config-if-ethernet1/0/1)#mac-ip access-group 3222 in #在接口下调用ACL

配置IP的扩展acl_b,任何时间仅允许访问同一网段(如192.168.1.255)内的主机。

Switch(config)#ip access-list extended vacl_b

Switch(config-ip-ext-nacl-vacl_a)# permit ip any-source 192.168.1.0 0.0.0.255

Switch(config-ip-ext-nacl-vacl_a)# deny ip any-source any-destination

Switch(config)#vacl ip access-group vacl_b in vlan 2将配置应用到VLAN。

ARP攻击防护

#开启ARP-Guard功能,防止PC机发出网关欺骗报文

Switch(config)#interface ethernet 1/1

Switch(Config-If-Ethernet1/1)#arp-guard ip

192.168.10.1

Switch(config)#exit

Switch(config)#interface ethernet 1/2

Switch(Config-If-Ethernet1/2)#arp-guard ip

192.168.20.1

#开启Anti-ArpScan功能,防止PC机发出大量ARP影响其他PC

Switch(config)#anti-arpscan enable 启动防ARP扫描

Switch(config)#anti-arpscan portbased threshold自每秒端口ARP上限30

Switch(config)#anti-arpscan recovery enable

开启防扫描自动恢复功能

Switch(config)#anti-arpscan recovery time 3600 自动恢复时间

Switch(config)#interface ethernet 1/24

Switch(config-If-Ethernet1/24)#anti-arpscan trust supertrust-port 配置为信任端口

Switch(config-If-Ethernet1/24)#exit

#针对静态IP用户,使用AM功能防止PC机发出主机欺骗报文。针对动态IP用户,使用DHCP Snooping Binding功能防止PC机发出主机欺骗报文。

NTP时间服务

Switch(config)#sntp server 1.1.1.10 #交换机上配置SNTP服务器地址

Switch(config)#ntp enable#交换机上使能NTP功能,并配置NTP服务器地址

Switch(config)#ntp server 1.1.1.10

Clock timezone beijing 8 配置中国时区

Clock set 15:30:00 aug 2 2014 配置时间(特权模式下)

RIP认证(MD5)

路由器:

ip rip authentication message-digest

ip rip authentication-key 1 md5 123 组编号1,密码123

交换机:

SWA(config)#key china name(key名称)

SWA(config-keychain)#key 1(编号)

SWA(config-keychain-key)#key-string 123(密码)

控制管理距离Distance

Distance 125(修改后) 0.0.0.0 255.255.255.255(路由更新源) 10(被ACL匹配的路由) 偏移列表(offset-list)

用于在入口或出口增大通过RIP获悉流量度量值

Router(config-router)#offset-list ACL编号 in/out 2(增加量) f0/0(接口)

修改管理ospf管理距离

Router(config-router)#distance 120(新AD值) 0.0.0.0 25.5.255.255 10(ACL匹配的路由)

分发列表distribute-list

R2(config)# access-list 1 deny 192.168.3.0

R2(config)# access-list 1 permit any

R2(config)# router rip

R2(config-router)# distribute-list 1 in fa0/0

分发列表是用于控制路由更新的一个工具,只能过滤路由信息,不能过滤LSA。因此:分发列表在距离矢量路由协议中使用,无论是in或者是out方向,都能正常的过滤路由。但是在链路状态路由协议中的工作就有点问题了。

Filter

R2(config)# access-list 1 permit any

R2(config-router)#filter s1/0 in access-list 1 在s1/0入口处,符合acl的网络可以通过ospf进行更新

策略路由

路由器

Router-A_config#ip access-list standard net1 !定义ACL

Router-A_config_std_nacl#permit 192.168.0.10 255.255.255.255

!设置需要进行策略路由的源地址

Router-A_config_std_nacl#exit

Router-A_config#route-map pbr 10 permit !定义route-map

Router-A_config_route_map#match ip address net1 !设定源地址

Router-A_config_route_map#set ip next-hop 192.168.1.2 !设置下一跳地址

Router-A_config_route_map#exit

Router-A_config_s1/1#int f0/0 !进入源地址的路由器接口

Router-A_config_f0/0#ip policy route-map pbr !绑定route-map

交换机

switch(config)#ip access-list extended To_10 #新建ACL

switch(config-ip-ext-nacl-to_10)#permit ip 192.168.1.0 0.0.0.255 192.168.10.0 0.0.0.255

switch(config-ip-ext-nacl-to_10)#deny ip any-source any-destination #匹配网段

switch(config)#class-map To_10 switch(config-classmap-to_10)#match access-group To_10 #定义classmap 调用ACL

switch(config)#policy-map To_10

switch(config-policymap-to_10)#class To_10 #定义policy map,调用class map

switch(config-policymap-to_10-class-to_10)#set ip nexthop 10.1.1.1 #指下一跳

switch(config)#interface ethernet 1/0/1

switch(config-if-ethernet1/0/1)#service-policy input To_10 #在接口下调用

QOS

QOS限制带宽

将来自192.168.1.0网段目的为192.168.10.0的流量下一跳指到10.1.1.1,其它流量不做策略路由。

switch(config)#ip access-list standard cir_tenM_cbs_fourM #新建ACL

switch(config-ip-std-nacl-cir_tenM_cbs_fourM)#permit 192.168.1.0 0.0.0.255

switch(config-ip-std-nacl-cir_tenM_cbs_fourM)#deny any-source #匹配网段

switch(config)#class-map cir_tenM_cbs_fourM

switch(config-classmap-cir_tenm_cbs_fourm)#match access-group cir_tenM_cbs_fourM #新建class map 调用ACL

switch(config)#policy-map cir_tenM_cbs_fourM

switch(config-policymap-cir_tenm_cbs_fourm)#class cir_tenM_cbs_fourM #新建policy

map 调用ACL

switch(config-policymap-cir_tenm_cbs_fourm-class-cir_tenm_cbs_fourm)#policy

exceed-action drop #带宽限制10Mbps,突发4Mbps

switch(config)#interface ethernet 1/0/1

switch(config-if-ethernet1/0/1)#service-policy input cir_tenM_cbs_fourM #接口下调用

10000 4000

QOS 优先级配置

在端口e1/1上,将属于网段192.168.1.0内的报文的优先级设置为5.

switch(config)#ip access-list standard pre5

switch(config-ip-std-nacl-pre5)#permit 192.168.1.0 0.0.0.255

switch(config-ip-std-nacl-pre5)#deny any-source #新建ACL,匹配网段

switch(config)#class-map pre5

switch(config-classmap-pre5)#match access-group pre5 #新建class map,调用ACL

switch(config)#policy-map pre5

switch(config-policymap-pre5)#class

pre5

switch(config-policymap-pre5-class-pre5)#set ip precedence 5 #新建policy map 调用class

map,并设置优先级为5

switch(config)#interface ethernet 1/0/1

switch(config-if-ethernet1/0/1)#service-policy input pre5 #接口下调用policy map QOS优先级队列

Router-A#conf

Router-A_config#ip access-list extended 1 !定义ACL

Router-A_config_ext_nacl#permit ip 192.168.0.10 255.255.255.0 192.168.2.2 255.255.255.0

Router-A_config_ext_nacl#exit

Router-A_config#ip access-list extended 2 !定义ACL

Router-A_config_ext_nacl#permit ip 192.168.0.20 255.255.255.0 192.168.2.2 255.255.255.0

Router-A_config_ext_nacl#exit

Router-A_config#priority-list 1 protocol ip high list 1 !定义优先级

Router-A_config#priority-list 1 protocol ip low list 2 !定义优先级

Router-A_config#int s1/1

Router-A_config_s1/1#priority-group 1 !应用在接口上

QOS 权重 配置

启用QOS,将端口e1/0/10 出口队列的权重改为1:1:2:2:4:4:8:8,调度算法为WRR,对应cos 0-7 出口队列1-8,如果进来的报文不带cos,将其设置为cos 5 放入队列6.

switch(config)#interface ethernet 1/0/10

switch(config-if-ethernet1/0/10)#mls qos queue algorithm wrr #配置WRR调试算法

switch(config-if-ethernet1/0/10)#mls qos queue wrr weight 1 1 2 2 4 4 8 8 #配置队列所占的权重,队列1-8分别对应cos 0-7

switch(config-if-ethernet1/0/10)#mls qos cos 5 #如果进端口的报文没有打cos,将其它打上cos 5

egress-qos

端口e 1/0/10 出方向,将dscp值为0的报文,其cos值改为4.

switch(config)#class-map dscp0tocos4

switch(config-classmap-dscp0tocos4)#match ip dscp 0 #定义class

switch(config)#policy-map dscp0tocos4

switch(config-policymap-dscp0tocos4)#class dscp0tocos4

switch(config-policymap-dscp0tocos4-class-dscp0tocos4)#set cos 4 # 定义policymap将dscp0的报文对应的cos值改为4

switch(config)#interface ethernet 1/0/10

switch(config-if-ethernet1/0/10)#service-policy output dscp0tocos4 #在接口上调用service-policy

IPSEC

设置为野蛮模式,在映射表中加入mode aggressive

配置实例:

R1_config#crypto isakmp key 0 12345 address 1.1.1.1 255.255.255.255

//设置远端IP地址、预共享密钥

R1_config#crypto isakmp policy 1 //创建IKE

R1_config_isakmp# authentication pre-share //认证方式为与共享密钥

R1_config_isakmp# hash md5 //哈希算法为MD5

R1_config_isakmp#exit

R1_config#crypto ipsec transform-set TS_TP0_1 esp-3des esp-md5-hmac //创建变换集合

R1-transform-set#exit

R1_config#crypto map IPSEC_TUNNEL_TP0 1 ipsec-isakmp //创建加密映射表

R1_crypto_map# match address ACL_TP0_1 //匹配IPSec流量

R1_crypto_map# set peer 1.1.1.1 //设置远端IP地址

R1_crypto_map# set transform-set TS_TP0_1 //匹配ESP加密方式和认证方式

R1_crypto_map#exit

R1_config#interface f0/0

R1_config_f0/0#ip address 1.1.1.2 255.255.255.0

R1_config_f0/0#ip nat outside

R1_config_f0/0#crypto map IPSEC_TUNNEL_TP0 //应用IPSec

R1_config_f0/0#exit

R1_config#interface f0/1

R1_config_f0/1#ip address 192.168.2.1 255.255.255.0

R1_config_f0/1#ip nat inside //接口、NAT相关配置

R1_config_f0/1#exit

R1_config#ip route default 1.1.1.1 //添加默认路由

R1_config#ip access-list extended NAT_WAN0_LIST

R1_config_ext_nacl# deny ip 192.168.2.0 255.255.255.0 192.168.1.0 255.255.255.0

//拒绝IPSec流量

R1_config_ext_nacl# permit ip 192.168.2.0 255.255.255.255 any //匹配NAT流量

R1_config_ext_nacl#exit

R1_config#ip access-list extended ACL_TP0_1 //匹配IPSec流量

R1_config_nacl# permit ip 192.168.2.0 255.255.255.0 192.168.1.0 255.255.255.0

R1_config_nacl#exit

R1_config#ip nat inside source list NAT_WAN0_LIST interface Virtual-tunnel0 //NAT相关配置

R1_config#

IPSEC Over GRE:

a. 访问控制列表,针对两个网段的数据流,如:

ip access-list extended vpn12

permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255

b. 加密图放在Tunnel口

GRE Over IPSEC:

a. 访问列表,针对两个路由器之间的GRE流,如: ip access-list extended vpn12

permit gre host 172.16.11.2 host 172.16.22.2

(config):ip access-list ex 100 //创建用于IPSec的ACL

(acl):per ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255 //要加密的数据流

(acl):exit

(config):ip access-list ex 101 //创建用于NAT的ACL

(acl):deny ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255 //禁止转化192.168.10.0到192.168.20.0的数据

(acl):per ip 192.168.10.0 0.0.0.255 any

(acl):exit

GRE

配置tunnel

interface tunnel 1

tunnel source 202.100.1.1

tunnel destination 202.100.1.2

tunnel gre ip

ip address 12.1.1.1

路由器广域网FR(帧中继)封装配置

RouterA:

Router#config

Router(config)#interface s 1/0

Router(config-serial1/0)#ip adderss 10.1.1.1 255.255.255.252

Router(config-serial1/0)#encapsulation frame-relay //端口数据封装协议

Router(config-serial1/0)#frame-relay local-dlci 17//增加一条可用的虚电路号

Router(config-serial1/0)#frame-relay intf-type dte//数据终端设备

Router(config-serial1/0)#frame-relay map 10.1.1.2 pvc 17 broadcast//映射ip

Router(config-serial1/0)#no shut

RouterB:

Router(config)#interface s 1/0

Router(config-serial1/0)#ip adderss 10.1.1.2 255.255.255.252

Router(config-serial1/0)#encapsulation frame-relay //端口数据封装协议

Router(config-serial1/0)#frame-relay local-dlci 17 //增加一条可用的虚电路号

Router(config-serial1/0)#frame-relay intf-type dce //设置为数据电路终端设备

Router(config-serial1/0)#frame-relay map 10.1.1.1 pvc 17 broadcast

Router(config-serial1/0)#no shut

防火墙命令 DCFW(config)# ip vrouter trust-vr (进入路由模式配置路由)

将eth6 接口加入二层安全域l2-trust

 DCFW-1800(config)# interface ethernet0/6

 DCFW-1800(config-if-eth0/6)# zone l2-trust

配置虚拟管理接口

DCFW-1800(config)# interface vswitchif1

 DCFW-1800(config-if-vsw1)# zone trust

 DCFW-1800(config-if-vsw1)# ip address 192.168.1.254/24

 DCFW-1800(config-if-vsw1)# manage ping

 DCFW-1800(config-if-vsw1)# manage https

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688419336a135632.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信