600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 网络工程师 考试命令合集 交换机 路由器 ACL NAT 防火墙等配置命令

网络工程师 考试命令合集 交换机 路由器 ACL NAT 防火墙等配置命令

时间:2020-12-07 13:50:15

相关推荐

网络工程师 考试命令合集 交换机 路由器 ACL NAT 防火墙等配置命令

交换机基本配置

display current-configuration //显示当前配置

display saved-configuration //保存的配置

auto speed 100//接口在自协商模式下 速率为100mbps

negotiation auto//自协商为全双工

display interface 端口 //查看该端口的状态

vlan x

management-vlan //设置管理vlan

port-group 1 //进入接口组视图

group-member gigabitethernet0/0/1 to gigabitethernet0/0/10 //组成员为1-10接口 方便一次操作多个接口

telnet远程登录

telnet server enable //启用远程登陆服务

user-interface vty 0 4 //开启VTY线路模式 0-4这5个用户

protocol inbound telnet //配置VTY支持telnet协议

authentication-mode aaa|password|none //配置认证方式

aaa //进入aaa视图

local-user 用户名 password [cipher|simple] 密码 //添加登录用户名密码(明文或密文)

local-user 用户名 privilege level 3 //设置用户权限 最大为15

return //回到用户视图

save //保存

console用户验证方式

user-interface console 0 //进入console控制台接口

authentication-mode aaa|password|none //验证模式为密码认证

如果是password即

authentication-mode password

则需配置密码

set authentication password [cipher] 密码

端口隔离(同一组实现隔离 不同组不隔离)

port-isolate mode l2|all //配置全局端口隔离为二层或三层隔离

interface 端口

port-isolate enable group 1 //端口开启隔离 并加入group1

添加静态MAC地址表项

mac-address static 0001-0002-0003 ethernet 1/0/1 vlan 5 //目的地址为0001-0002-0003,vlan5的报文从接口1/0/1转发出去

display mac-address //查看MAC地址表

vlan

基于端口划分

undo vlan 3 //撤销vlan

vlan batch 10 to 15 //vlan 10 11 12 13 14 15 批量创建vlan

vlan 3

name huawei //vlan3 设置名字为huawei 下次进入vlan3可用vlan vlan-name huawei

port link-type hybrid //混合模式

port hybrid untagged|tagged vlan 5 //带不带标记,并加入vlan5

port default vlan id, port trunk allow-pass vlan all|id to id //其他两个模式

interface vlanif 1 //进入交换机虚接口

ip address 192.168.1.1 24 //设置ip

基于mac地址划分

vlan 3

mac-vlan mac-address 0001-0002-0003 //MAC地址和vlan3关联

interface ethernet 0/0/1

mac-vlan enable //在接口下使能MAC地址的划分

gvrp的配置

normal,fixed:禁止动态注册注销vlan,只传播静态vlan信息,forbidden:只传播vlan1的信息。

gvrp //全局使能GVRP

各接口设置为trunk 允许所有vlan信息

interface ethernet 0/0/1

gvrp

gvrp registration normal|fixed|forbidden //注册模式

display gvrp statistics //查看接口的GVRP统计信息

stp的配置

stp mode stp|rstp //运行stp或rstp

stp root primary //交换机指定为根桥

stp root secondary //交换机指定为备份根桥

stp priority 优先级 //设置网桥的优先级 4096的倍数

stp pathcost-standard legacy //华为的路径开销算法legacy

Ethernet0/0/1

stp cost 20000 //手动设置端口路径开销 20000为最大,一般把将阻塞的端口设为此

stp edged-port enable //与PC相连的端口设为边缘端口

stp bpdu-filter enable //启用bpdu报文过滤

stp enable |disable //交换机启用或关闭stp功能

路由器配置

dhcp服务器配置

dhcp enable //全局使能DHCP功能

ip pool pool1 //创建地址池pool1

network 192.168.1.0 mask 255.255.255.0 //范围

gateway-list 192.168.1.254 //网关

dns-list ip1 ip 2 //dns地址

lease day 1 hour 10 //租约信息 1天10小时

static-bind ip-address 192.168.1.1 mac-address 0001-0002-0003 //静态绑定MAC地址和ip

excluded-ip-address 192.168.1.10 //不分配的IP地址

interface ethernet0/0/1

dhcp select global //使能接口采用全局地址池的DHCP功能

dhcp relay server-ip 12.12.1.1 //dhcp中继代理的设置

静态路由设置

ip route-static 192.168.1.0 24 192.168.10.1

ip route-static 192.168.1.0 255.255.255.0 s0

ip route-static 0.0.0.0 0.0.0.0 10.0.0.1

display ip routing-table // 查看路由表

ipv6静态路由

进入接口

ipv6 enable

ipv6 address 1::1 64

ipv6 route-static : : 0 12::2 //下一跳都是转发给12::2(默认路由)

ipv6 route-static 1: : 64 12::1 //静态路由配置

display ipv6 routing-table

动态路由

优先级,直连路由:0,ospf:10,is-is:15,静态路由:60,rip:100,BGP:255

cost为度量值 ,度量值越小越好

rip(30s) ripv1广播 v2组播224.0.0.9 ripng是ipv6的协议

rip 1

version 2

network 10.0.0.0

undo summary //取消路由汇聚功能

peer 10.0.0.3 //说明邻接路由器

display rip route //查看rip协议的路由信息

display rip interface //查看rip接口信息

bfd快速收敛与rip联动

bfd //全局使能BFD

rip 1 //进入rip视图

bfd all-interfaces enable //所有接口启动bfd功能

ospf

router id 1.1.1.1 //路由器标识

ospf 1

area 0 //骨干网,area1 区域为0.0.0.1

network 192.168.2.0 0.0.0.255

display ospf routing //查看ospf路由信息

display ospf peer //查看邻居信息

ospf cost 开销值 //手动设定开销值

is-is中间系统到中间系统 类似ospf

isis 1

is-level level-1

network-entity net

isis enable

display isis route

display isis peer

路由重发布 (边界路由器)

rip 1 //进入rip视图

import-route ospf 109 cost 10(不大于15)

ospf 1

import-route rip 1 cost 200

import-route static //静态路由重发布

BGP协议

vrrp

vrrp vrid 1 virtual-ip 192.168.1.254 //虚拟网关ip为192.168.1.254

vrrp vrid 1 priority 120 //优先级

vrrp vrid 1 track interface gi0/0/2 reduced 100(如果gi0/0/2端口的状态变为down,则优先级降低100,变为20)

ACL

acl 编号 //基本acl为2000-2999(仅源time),高级acl为3000-3999,二层acl4000-4999

rule permit source 172.168.1.1 0.0.0.0

通配符掩码(反掩码)255.255.255.255表示主机

description xxx //只当做描述

[可选]

acl [number] 2000 [match-order:auto|config] //顺序规则config或者自动排序规则auto(深度优先原则)默认config

acl name xx [basic]

基本acl

rule [步长] deny|permit source ip+反掩码|any time-range time-name

//步长默认为5,再默认以5增长,可自定义步长

//any=0.0.0.0 255.255.255.255

time-range 名称 8:00 to 18:00 working-day

//work-day表示周一到周五 off-day周六周日 daily 每天 0-6 表示每周几 0为星期天

rule deny source 172.16.0.0 0.0.255.255 time-range 名称 //指定时间拒绝

display acl resource

traffic-filter outbound acl name test //接口直接应用ACl规则

高级acl

rule deny tcp destination-port eq|gt|lt|neg telnet|23 source 192.168.1.0 0 destination 172.16.200.0 0.0.0..255 //禁止源ip192.168.1.0目的ip172.16.200的 tcp端口号等于23 的数据包通过 souce-port

rule permit icmp source xx destination xx 允许ping

Qos策略

traffic classifier c1 operate and|or //创建流分类

以下面两个流分类为例,对于tc1来说,报文必须同时匹配ACL2001(或ACL3001),802.1p优先级为5和三层协议类型为IP协议三个规则时才属于该类。

[switch] traffic classifier tc1 operator and

[switch-classifier-tc1] if-match acl 2001

[switch-classifier-tc1] if-match 8021p 5

[switch-classifier-tc1] if-match acl 3001

[switch-classifier-tc1] if-match protocol ip

对于tc2来说,报文匹配ACL3001或者报文802.1p优先级为6时都属于该类。

[switch] traffic classifier tc2 operator or

[switch-classifier-tc2] if-match acl 3001

[switch-classifier-tc2] if-match 8021p 6

在一个流行为中可以定义一个或多个动作,如下流行为tb1表示对匹配分类的报文进行流量监管,限速为4096kbit/s,同时进行流量统计。

[switch]traffic behavior tb1 //创建流行为

[switch-behavior-tb1] car cir 4096 //cir为每秒可通过的速率

[switch-behavior-tb1] statistic enable

流行为tb2表示将匹配分类的报文重定向到下一跳10.10.10.1。

[switch] traffic behavior tb2

[switch-behavior-tb2] redirect ip-nexthop 10.10.10.1

以下面的配置为例,流策略tp1表示对匹配tc1规则的报文执行tb1的动作,对匹配tc2规则的报文执行tb2动作。

[switch] traffic policy tp1 match-order config //流策略

[switch-trafficpolicy-tp1] classifier tc1 behavior tb1

[switch-trafficpolicy-tp1] classifier tc2 behavior tb2

应用流策略

流策略配置完之后,需要选择该策略在设备上生效的范围。流策略可以应用在接口、VLAN和全局的出方向和入方向,其中接口包括物理接口、子接口、VLANIF接口和Eth-Trunk接口等。以接口为例,在指定接口入方向应用某个流策略,表示对进入该接口且匹配流分类规则的流量执行指定动作。如下所示:

[switch] interface GigabitEthernet 1/0/1

[switch-GigabitEthernet1/0/1] traffic-policy tp1 inbound

设备上还配置了一个流策略tp2,且应用在VLAN30上

[switch-vlan30] traffic-policy tp2 inbound

二层acl(源地址 目的地址 802.1p优先级 二层协议类型等)

rule deny cos 3 //禁止802.1p优先级为3的报文通过

rule deny destination-mac xx-xx-xx //mac地址

ipv6-over-ipv4 GRE隧道

interface tunnel0/0/1 //进入隧道口

tunnel-protocol GRE //GRE隧道协议

keepalive //开启keepalive

ipv6 enable

ipv6 address fc02::1 64 //给隧道口配置ipv6地址

source 10.1.1.1 //源ip地址

destination 10.1.2.2 //目的ip地址

gre key 123 //配置隧道的验证key123

路由器都配置完后,配置路由器的tunnel静态路由

R1::ipv6 route-static fc03::1 64 tunnel0/0/1

R2:ipv6 route-static fc01::1 64 tunnel0/0/1

ipv6 ISATAP隧道

interface tunnel0/0/1

tunnel-protocol ipv6-ipv4 isatap //isatap协议

ipv6 enable

ipv6 address 2001:: 64 eui-64 //给隧道口配置ipv6地址

source gigabitethernet2/0/0 //tunnel源地址或源端口

undo ipv6 nd ra halt //使能系统发布RA报文功能

NAT配置

静态NAT(一对一)

interface seriall0/0/1 //在外网接口下配置

nat static global 202.10.10.1 inside 192.168.1.1 //把公网global地址和inside内网地址绑定

动态NAT(多对多)

interface seriall0/0/1 //在外网接口下配置

nat address-group 1 202.10.1.20 202.10.1.50 //把20-50的地址分为一个组,供内网使用

acl 2000

rule 5 permit source 192.168.1.0 0.0.0.255 //给内网需要Nat转换的地址匹配acl允许

interface seriall0/0/1 //在外网接口下配置

nat outbound 2000 address-group 1 no-pat //使用nat outbound命令将ACL 2000 与地址池相关联,,使得ACL中规定的地址,可以使用地址池,no-pat不可重用

display nat outbound //在路由器上查看NAT bound信息

NAPT(一对多)pat

nat address-group 0 202.10.1.20 202.10.1.20 //只有一个ip的组

nat outbound 2000 address-group 0 //实现1对多

Easy-IP

nat outbound 2000 //直接使用接口的ip对应内网的ip, 不需要创建地址池,大大节省了地址空间,

display nat session protocol tcp|udp

配置NAT Server

nat server protocol tcp global 202.169.10.6 ftp inside 192.168.1.5 ftp

// nat server命令定义内部服务器的映射表,指定服务器通信协议类型为TCP,,配置服务器使用的公网IP地址为202.169.10.6,服务器内网通信地址为192.168.1.5,指定端口为21,该常用端口号可以直接使用关键字“ftp”代替。

防火墙配置

firewall zone inside //定义一个区域名字叫inide

priority 15 //定义优先级为15

firewall zone outside //定义一个区域名字叫outside

priority 5 //定义优先级为5

firewall interzone inside outside //定义inside区域可以主动访问outside,outside不可主动访问inside ,必须先inside后outside

firewall enable //开启功能

interface ethernet0/0/1 //进入接口

zone inside //配置此接口为inside区域

interface ethernet0/0/1 //进入接口

zone inside //配置此接口为inside区域

display firewall session [protocol ] //查看防火墙建立的会话,外网只有会话才能访问内网

如果想让外网能访问内网telnet服务器则

acl 3000

rule permit tcp desitination 192.168.1.100 destitation-port eq telnet //服务器ip192.168.1.100

firewall interzone inside outside

packet-filter 3000 inbound //包过滤

ipsec

还有个ipsec和BGP协议当时没有写上(考完就忘了),如果有小伙伴有的话可以私聊我加上去,谢谢了

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。