回顾 HCIA

文章详细介绍了OSPF和RIP两种路由协议的原理、配置及区别,包括邻居关系、路由更新、区域划分等内容。同时,提到了VLAN的创建与接口划分,以及DHCP服务的配置和管理。此外,还讨论了ACL的使用场景和配置方法,用于流量控制和安全设置。
摘要由CSDN通过智能技术生成

Osi七层参考模型

应用层:通过人机交互实现不同的服务

表示层:编码 解码 加密解密

会话层:建立 维持 终止会话进程

传输层:通过端口号区分不同的服务 数据分段 确认 重传 排序 流控

网络层:通过ip地址进行逻辑寻址 路由器

数据链路层:mac 媒介访问控制层

物理层:定义电气电压接口规范光学特性

遇到的问题:

1.信号的衰减

2.信号的失真

交换机的功能:

1.无限延长传输距离

2.实现单波

双绞线的有效传输距离为100m

CSMA/CD 载波侦听多路访问

冲突域

数据分段

Mtu 最大传输单元  1500b

Mss 最大段长度    1480b

数据的封装 解封装

路由器的功能:

1.分割广播域

2.路由功能

端口号的取值范围0-65535

1-1023 为著名端口号

1024-65535为高端口号动态端口号

通过端口号区分不同的服务

ftp 文件传输协议  tcp 21

Telnet 远程登录协议  tcp 23

http 超文本传输协议  tcp 80 8080

https 安全的http协议  tcp443

Dns 域名解析协议  udp /tcp53

Tcp面向连接的可靠传输协议

可靠性体现在 确认 重传 排序 流控(滑动窗口)、

面向连接 :三次握手和四次交换

PDU 桥协议数据单元

上三层          数据    data message

传输层          数据段  segment

网络层          数据包  packet

数据链路层      数据帧  frame

物理层          比特流  bit

常见的三层协议:

Ip协议

ICMP协议 网络控制管理协议 包含ping

Arp 地址解析协议

常见的四层协议

Udp

Tcp

Ttl 生存时间取值范围 0-255 每经过一台路由器减1为0时不传递

协议 TCP  6  标识上层协议

     UDP 17

     EIGRP 88  cisco私有协议

     OSPF 89

Ipv4地址 32位 有2^32个

完整的ipv4地址是需要配合子网掩码使用,ipv4地址分为网络位和主机位

Ipv4地址的分类

在默认情况下通过第一个8位就可以辨别类别;

A  0 0000000---0 1111111     0-127   /8

B  10 000000---10 111111     128-191 /16

C  110 00000---110 11111     192-223 /24

D  1110 0000---1110 1111     224-239

E  1111 0000----1111 1110     240-254

Abc 为单波地址  d组播地址  e科研使用

子网掩码不同一定是不同网段,子网掩码相同,不一定是同一网段

与1不变与0变0

192.168.1.1/24  255.255.0.0

11000000.10101000.00000001.00000001

11111111.11111111.00000000.00000000

11000000.10101000.00000000.00000000

192.168.0.0

192.168.2.1  255.255.0.0

11000000.10101000.00000010.00000001

11111111.11111111.11111111.00000000

192.168.0.0

在单播地址中还存在私有地址和公有地址分类:

公有地址:全球唯一性  需要付费使用

私有地址:本地唯一性  无需付费

A:10.0.0.0/8     

B:172.16.0.0/16-172.31.0.0/16

C:192.168.0.0/24-192.168.255.0/24

特殊ip地址:

0.0.0.0/0 无效地址/缺省地址

255.255.255.255受限广播地址

127.0.0.1/8 本地环回地址

192.168.1.00000000/24 代表本网段内所有主机

192.168.1.11111111/24 代表本网段内的广播地址

169.254.0.0/16 本地私有地址

Vlsm 可变长子网掩码

172.16.0.0/16+3  8个学院 2^3=8

10101100.00010000.   000  00000.00000000

                    001

                    010

                    011

                    100

                    101

                    110

                    111

172.16.0.0/19

172.16.0.1-172.16.31.254

172.16.32.0/19

32.1-73.254

172.16.64.0/19

64.1-95.254

172.16.96.0/19

172.16.128.0/19

172.16.160.0/19

172.16.192.0/19

172.16.224.0/19

192.168.2.0/23 划分7个网段写出可用地址范围

子网汇总

满足连续子网(母网号相同,子网掩码一致)

192.168.1.0/24

192.168.2.0/24

11000000.10101000.000000 01.00000000

11000000.10101000.000000 10.00000000

11000000.10101000.000000 00.00000000

192.168.0.0/22

172.16.2.0/24

172.16.35.0/24

172.16.88.0/24

172.16.128.0/24

172.16.10000000.00000000

172.16.0.0/16

172.16.1.0/24

172.16.2.0/24

172.16.0.0/22>16

192.168.1.0/24

192.168.2.0/24

192.168.0.0/22<24 超网

双绞线线序

T-568A         T-568B

直通线:不同层设备使用 A-A B-B

交叉线:同层设备使用   A-B

Vrp的基础操作

设备的基本模式

<Huawei>  用户视图模式 可以进行所有查看以及简单的配置

华为帮助系统 ? tab自动补全

查看设备时间

<Huawei>display  clock

2020-01-01 01:01:22

Wednesday

Time Zone(China-Standard-Time) : UTC-08:00

修改设备时间

<Huawei>clock datetime 1:1:1 2020-1-1

打开debug

<R2>terminal debugging

Info: Current terminal debugging is on.

<R2>debugging ip icmp

关闭

<R2>undo debugging all

Info: All possible debugging has been turned off

重启指令

<r1>reboot

系统视图模式

<r1>system-view

Enter system view, return user view with Ctrl+Z.

[r1]  可以对设备进行所有的修改

设备的预配指令(提前配置好)

修改设备名称

[Huawei]sysname wangcai

[wangcai]

永不超时

[wangcai]user-interface console 0

[wangcai-ui-console0]idle-timeout ?

  INTEGER<0-35791>  Set the number of minutes before a terminal user times out

[wangcai-ui-console0]idle-timeout 0 ?

  INTEGER<0-59>  Set the number of seconds before a terminal user times out

  <cr>           Please press ENTER to execute command

[wangcai-ui-console0]idle-timeout 0 0

给设备基本加密

[wangcai]user-interface console 0

[wangcai-ui-console0]authentication-mode password

Please configure the login password (maximum length 16):hcia

退出

Quit 一层一层往出退  end 直接退出到特权

使用密码给设备权限

[Huawei]user-interface console 0

[Huawei-ui-console0]user privilege level ?

  INTEGER<0-15>  Set a priority, the default value is 0

[Huawei-ui-console0]user privilege level

使用用户名和密码进行加密

AAA 认证 授权 审计

[Huawei]aaa

[Huawei-aaa]local-user xx privilege level 15 password cipher yy  给最高权限

Info: Add a new user.

[Huawei-aaa]local-user xx service-type terminal

改服务类型

[Huawei-aaa]local-user nn privilege level 0 password cipher oo 给最低权限

[Huawei]user-interface console 0

[Huawei-ui-console0]authentication-mode aaa 调用

接口类型

Ethernet0/0/0       10m

fastEthernet0/0/0    100m

GigabitEthernet0/0/0 1000m

Ten-GigabitEthernet0/0/0 10000m

单工  双工(半双工 全双工)

给接口配置Ip地址

[R1]interface g0/0/0

[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24

[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 255.255.255.0

查看接口

[R1]display ip int brief

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 1

The number of interface that is DOWN in Physical is 3

The number of interface that is UP in Protocol is 1

The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  

GigabitEthernet0/0/0              12.1.1.1/24          down       down      

GigabitEthernet0/0/1              unassigned           down       down      

GigabitEthernet0/0/2              unassigned           down       down      

NULL0  

Physical up表示可以正确识别电流

Protocol up表示可以正确识别数据

只有在双up的情况下才可以正常通信

网络组建步骤:

1、拓扑设计

2、IP地址规划--按照拓扑中划分的网络范围,规划网络位不同的IP地址

3、配置

1)配置各个节点的IP地址

2)路由--全网可达

3)测试--ping

4)策略

5)优化

       安全

6)排错

维护和升级

Dhcp动态主机获取ip地址

成为dhcp服务器的条件

1.必须有连接广播域真是物理接口或物理网卡

2.该接口必须有合法的ip地址

配置

[dhcp]dhcp enable 开启dhcp服务

Info: The operation may take a few seconds. Please wait for a moment.done.

[dhcp]ip pool hcia 创建dhcp地址池

Info: It's successful to create an IP address pool.

[dhcp-ip-pool-hcia]network 192.168.1.0 mask 255.255.255.0  下方地址

[dhcp-ip-pool-hcia]gateway-list 192.168.1.1

网关地址

[dhcp-ip-pool-hcia]dns-list 8.8.8.8 114.114.114.114

Dns服务器地址

调用

[dhcp]interface g0/0/0

[dhcp-GigabitEthernet0/0/0]dhcp select global

Dhcp的数据包

1.dhcp discover dhcp 发现包

2.Dhcp offer   dhcp 提供包

3.Dhcp request dhcp 请求包

4.Dhcp ack    dhcp  确认包

排除段地址

[Huawei]ip pool xx

[Huawei-ip-pool-xx]excluded-ip-address 192.168.1.250 192.168.1.254

固定下放地址

[Huawei-ip-pool-nn]static-bind ip 192.168.1.3 mac-address 5489-985E-62C6

[Huawei-ip-pool-nn]static-bind ip 192.168.1.5 mac-address 5489-9851-4FAB

查看路由表

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

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

Routing Tables: Public

         Destinations : 7        Routes : 7        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet

0/0/0

       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet

0/0/0

     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet

0/0/0

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0

      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0

127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

Pre优先级 用来衡量路由的可信度 取值范围0-255  0表示绝对信任  255表示即便没有其他路径也不走该路径 越小越优

初始优先级

Direct  0     ciso  connect 0

Static  60          static  1

[R1]display cu 查看路由器缓存

Cost 度量值 用来衡量路径的优劣 越小越优

Rip用跳数来衡量

Ospf 用带宽来衡量

Eigrp(cisco私有)使用复合度量来衡量

查看接口信息

<R1>display interface g0/0/0

路由转发规则

1.最长匹配原则

2.递归查找

静态路由

下一跳写法 使用在以太网环境中

[R1]ip route-static 23.1.1.0 255.255.255.0 12.1.1.2

      未知网段 未知网段子网掩码 下一跳ip地址

出接口写法

[R1]ip route-static 23.1.1.0 24 s4/0/0 使用在串行链路中

出接口下一跳写法

[R1]ip route-static 23.1.1.0 24 Serial 4/0/0 12.1.1.2

缺省路由

需要访问外网的时候使用

[Huawei]ip route-static 0.0.0.0 0 10.1.1.2

192.168.1.0 255.255.255.0

192.168.2.0 255.255.255.0

192.168.3.0 255.255.255.0

192.168.00000001

       00000010

       00000011

192.168.0.0/22

路由汇总

[R1]ip route-static 192.168.0.0 22 12.1.1.2

空接口路由

[R3]ip route-static 192.168.0.0 22 NULL 0

等价路由

 23.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet

0/0/0

                    Static  60   0          RD   21.1.1.2        GigabitEthernet

0/0/1

查看静态

[Huawei]display current-configuration | in static

ip route-static 23.1.1.0 255.255.255.0 12.1.1.2

ip route-static 23.1.1.0 255.255.255.0 21.1.1.2 preference 61

查看静态路由

[Huawei]display ip routing-table protocol static

配置环回接口(测试tcp/ip协议栈)

[Huawei]interface LoopBack ?

  <0-1023>  LoopBack interface number

[Huawei]interface LoopBack 0

[Huawei-LoopBack0]ip address 192.168.1.1 32

动态路由协议分类

1.根据AS分类为

AS 自治系统 0-65535 公有0-64511 私有64512-65535

 Igp 内部网关协议

Rip  ospf  isis eigrp(cisco)

Egp 外部网关协议

Bgp

2.根据更新方式

DV 距离矢量型路由协议

LS 链路状态型路由协议

有类 更新时不携带子网掩码

无类 更新时携带子网掩码

Rip 路由信息协议

版本

V1 有类距离矢量型路由协议  广播更新 更新地址255.255.255.255

v2 无类距离矢量型路由协议 组播更新 更新地址 224.0.0.9

Ng 使用在ipv6中

周期更新每 30s更新一次 更新内容 路由条目,支持等价路由 默认4 条 最大6 条,(cisco)ios 版本12.4以上16条

基于udp 520端口进行工作。

Ripv1的配置

[R3]rip 1

[R3-rip-1]version 1

[R3-rip-1]network 23.0.0.0 宣告直连的作用 路由功能

激活该接口 使该接口具备接收和发送rip更新的能力

[R3-rip-1]network 3.0.0.0

Rip的跳数限制 最大15跳16跳不可达(只适用于小型网络)

Rip的破环机制

触发更新

水平分割:从此口进,不从此口出

毒性逆转水平分割

计时器

周期更新 每30s更新一次

无效计时器 180s

垃圾计时器 120s

查看计时器

[R3]display  rip

Public VPN-instance    

    RIP process : 1

       RIP version   : 1

       Preference    : 100

       Checkzero     : Enabled

       Default-cost  : 0

       Summary       : Enabled

       Host-route    : Enabled

       Maximum number of balanced paths : 8

       Update time   : 30 sec              Age time : 180 sec

       Garbage-collect time : 120 sec

查看rip路由条目

<R3>display ip routing-table protocol rip

Route Flags: R - relay, D - download to fib

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

Public routing table : RIP

         Destinations : 3        Routes : 3        

RIP routing table status : <Active>

         Destinations : 3        Routes : 3

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.0.0.0/8   RIP     100  2           D   23.1.1.1        GigabitEthernet

0/0/0

        2.0.0.0/8   RIP     100  1           D   23.1.1.1        GigabitEthernet

0/0/0

       12.0.0.0/8   RIP     100  1           D   23.1.1.1        GigabitEthernet

0/0/0

RIP routing table status : <Inactive>

         Destinations : 0        Routes : 0

Ripv2的配置

[R3]rip 1

[R3-rip-1]version 2

[R3-rip-1]network 12.0.0.0

[R3-rip-1]network 23.0.0.0

V1和v2的区别

V2支持vlsm 和cidr

V2是无类 v1是有类

V2支持所有的扩展配置

Rip的扩展配置

1.给接口做rip认证

(1)明文认证

[R1]interface g0/0/0

[R1-GigabitEthernet0/0/0]rip authentication-mode simple cipher 123

(2)密文认证

[R3]interface g0/0/0

[R3-GigabitEthernet0/0/0]rip authentication-mode md5 usual cipher 123

Md5加密

1.不可逆推性

2.雪崩效应

1+1=2 2-1=1

2.路由汇总

[R3]interface g0/0/0

[R3-GigabitEthernet0/0/0]rip summary-address 192.168.0.0 255.255.252.0 cisco不支持超网汇总

3.加快收敛速度

 周期更新 30s

 失效时间 180s

 垃圾收集时间120

[R3]rip 1

[R3-rip-1]timers rip 15 90 60

更新时间  失效时间 垃圾收集时间

4.静默接口

[R3]rip 1

[R3-rip-1]silent-interface g0/0/1

5.下放缺省路由

[R1]rip 1

[R1-rip-1]default-route originate

如何判断一个协议的好坏

1.选路佳

2.占用资源少

3.收敛速度快

Ospf 开放式最短路径优先

V1/v2使用在ipv4中 无类别链路状态型路由协议

V3 使用在ipv6中 ospf触发更新 同时存在周期更新 每30min更新一次  组播更新 更新地址 224.0.0.5(DR/BDR)以太网环境中和224.0.0.6(串行链路中)

支持等开销负载均衡

Ospf更新内容为 lsa (链路状态通告)11类 6类

               Lsdb  链路状态数据库

Ospf的5个数据包

Hello 包  发现 维持 创建邻居关系 hello 10s dead 40s

Dbd  数据库摘要

Lsr  链路状态请求

Lsu  链路状态更新

Lsack 链路状态确认包

Hello包

Router-id 标识路由器路由器的名字 先比较环回地址越大越优 若没有环回地址比较物理接口地址,建议手工进行修改(每台路由器的router-id不能相同)

Area id  区域号

Router priority  干涉选举

Hello and dead  10s和40s

Authentication 做认证

Dr   

Bdr

Stub  特殊区域

Rip是通过跳数去选择最优路径

Ospf是通过带宽

Cost=参考带宽/实际带宽

默认参考带宽为100m

Ospf邻居关系  ospf的邻接关系

Ospf的7个状态机

1.Down 当发送过来的hello中有自己的hello

2.Init  当发来的hello中有对方的router-id

3.2-way 邻居关系建立 选举主从关系

4.Exstart 选举 dr/bdr

5.Exchange 交换 dbd

6.Loading 通过lsr去要对方的lsa 对方通过lsu承载lsa

7.Full 邻接关系建立完成,生成最短路径树加入到路由表中

在ospf 中存在三种角色 DR   BDR   DROTHER

在以太网环境中 所有设备只和DR和BDR建立邻接关系 DR0THER和DROTHER之间建立的是邻居关系

Ospf的基本配置

1.1.1.1255.255.255.255

0.0.0.0

11111111.11111111.11111111.11111111

00000000.00000000.00000000.00000000

0.0.0.0 在反掩码里 0表示关注 1表示不关注

1.1.1.0 0.0.0.255

[R1]ospf 100  router-id 1.1.1.1 配置router-id

[R1-ospf-100]area 0 区域号

[R1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0

[R1-ospf-100-area-0.0.0.0]network 12.1.1.1 0.0.0.0

Ospf的第二种宣告方式

[R3]interface g0/0/0

[R3-GigabitEthernet0/0/0]ospf enable 100 area 0

1.ospf的邻居表

[R1]display  ospf peer  brief

 OSPF Process 100 with Router ID 1.1.1.1

  Peer Statistic Information

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

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        

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

邻居详细信息

[R1]display  ospf peer

 OSPF Process 100 with Router ID 1.1.1.1

 Neighbors

 Area 0.0.0.0 interface 12.1.1.1(GigabitEthernet0/0/0)'s neighbors

 Router ID: 2.2.2.2          Address: 12.1.1.2        

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 12.1.1.1  BDR: 12.1.1.2  MTU: 0    

   Dead timer due in 37  sec

   Retrans timer interval: 5

   Neighbor is up for 00:26:36     

   Authentication Sequence: [ 0 ]

查看ospf接口状态

[R1]display ospf 100 interface g0/0/0

 OSPF Process 100 with Router ID 1.1.1.1

 Interfaces

 Interface: 12.1.1.1 (GigabitEthernet0/0/0)

 Cost: 1       State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 12.1.1.1

 Backup Designated Router: 12.1.1.2

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

查看ospf的状态

[R1]display  ospf 100 brief

查看ospf的路由表

[R1]display ip routing-table  protocol  ospf

Route Flags: R - relay, D - download to fib

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

Public routing table : OSPF

         Destinations : 3        Routes : 3        

OSPF routing table status : <Active>

         Destinations : 3        Routes : 3

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.2/32  OSPF    10   1           D   12.1.1.2        GigabitEthernet

0/0/0

        3.3.3.3/32  OSPF    10   2           D   12.1.1.2        GigabitEthernet

0/0/0

       23.1.1.0/24  OSPF    10   2           D   12.1.1.2        GigabitEthernet

0/0/0

OSPF routing table status : <Inactive>

         Destinations : 0        Routes : 0

[R1]display ospf routing

 OSPF Process 100 with Router ID 1.1.1.1

  Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop         AdvRouter       Area

 1.1.1.1/32         0     Stub       1.1.1.1         1.1.1.1         0.0.0.0

 12.1.1.0/24        1     Transit    12.1.1.1        1.1.1.1         0.0.0.0

 2.2.2.2/32         1     Stub       12.1.1.2        2.2.2.2         0.0.0.0

 3.3.3.3/32         2     Stub       12.1.1.2        3.3.3.3         0.0.0.0

 23.1.1.0/24        2     Transit    12.1.1.2        3.3.3.3         0.0.0.0

 Total Nets: 5  

 Intra Area: 5  Inter Area: 0  ASE: 0  NSSA: 0

Ospf的数据库表

[R1]display  ospf lsdb

 OSPF Process 100 with Router ID 1.1.1.1

 Link State Database

         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    2.2.2.2         2.2.2.2            678  60    80000007       0

 Router    1.1.1.1         1.1.1.1            720  48    80000007       0

 Router    3.3.3.3         3.3.3.3            671  48    80000005       0

 Network   23.1.1.2        3.3.3.3            671  32    80000003       0

 Network   12.1.1.1        1.1.1.1            720  32    80000003       0

[R2]display  ospf error ospf错误信息收集表

Ospf区域划分的规则

1.必须满足星型结构

2.必须存在ABR(区域边界路由器)

类型               通告者         通告内容

Router         自己本身         本区域链路状态

Network        DR              描述MA网络

Summery       ABR             域外路由条目

DR和BDR的选举规则

1.先比较优先级 (越大越优)

2.比较router-id (越大越优)

3.非抢占性

修改优先级

[R3]interface g0/0/1

[R3-GigabitEthernet0/0/1]ospf dr-priority 2

必须手工重启

<R3>reset ospf process

Warning: The OSPF process will be reset. Continue? [Y/N]:y

hcia第五天

ospf扩展配置

1.ospf的接⼝认证

[r2]interface g0/0/0

[r2-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123

接⼝明⽂认证

[r3]interface g0/0/1

[r3-GigabitEthernet0/0/1]ospf authentication-mode simple cipher 123

[r3-GigabitEthernet0/0/1]ospf authentication-mode md5

密⽂认证

2.ospf的区域认证

[r2]ospf 100

[r2-ospf-100]area 1

[r2-ospf-100-area-0.0.0.1]authentication-mode simple cipher 123

区域明⽂认证

[r4]ospf 100

[r4-ospf-100]are

[r4-ospf-100]area 2

[r4-ospf-100-area-0.0.0.2]authentication-mode simple cipher 123

[r4-ospf-100-area-0.0.0.2]authentication-mode md5

汇总路由

区域汇总 必须在abr上来操作

[r3]ospf 100

[r3-ospf-100]area 2

[r3-ospf-100-area-0.0.0.2]abr-summary 192.168.0.0 255.255.252.0

通过区域汇总的路由条⽬为三类lsa

加快收敛速度

[r1]interface g0/0/0

[r1-GigabitEthernet0/0/0]ospf timer hello 5

[r1-GigabitEthernet0/0/0]ospf timer dead 20。dead时间默认⾃动4倍匹配

静默接⼝(只接收不发送,使⽤在连接客户的接⼝)

[r4]ospf 100

[r4-ospf-100]silent-interface g0/0/1

在⾃⼰本身有缺省路由的情况下

[r1]ospf 100

[r1-ospf-100]default-route-advertise

在⾃⼰本身没有缺省路由的情况下使⽤

[r1]ospf 100

[r1-ospf-100]default-route-advertise always

通过查看lsdb发现下放的缺省路由为5类lsa

交换部分

1.vlan

查看vlan列表

[Huawei]display vlan

The total number of vlans is : 1

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

U: Up; D: Down; TG: Tagged; UT: Untagged;

MP: Vlan-mapping; ST: Vlan-stacking;

#: ProtocolTransparent-vlan; *: Management-vlan;

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

VID Type Ports

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

1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(D) Eth0/0/4(D)

 Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)

 Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D)

 Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D)

 Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D)

 Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D)

同⼀vlan下的所有接⼝可以互相通信,不同vlan之间不能通信

vlan虚拟局域⽹ 可以分割⼴播域

创建单个vlan

[Huawei]vlan 2

[Huawei-vlan2]

同时创建多个vlan

[Huawei]vlan batch 2 to 10

Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]

[Huawei]vlan batch 2 to 5 7 9

划⼊接⼝ 划⼊单个接⼝

[Huawei]interface e0/0/2

[Huawei-Ethernet0/0/2]port link-type access

[Huawei-Ethernet0/0/2]port default vlan 3

同时划⼊多个接⼝

[Huawei]port-group 1

[Huawei-port-group-1]group-member e0/0/1 to e0/0/10

[Huawei-port-group-1]port link-type access

[Huawei-port-group-1]port default vlan 2

同时划⼊vlan

[Huawei]vlan 3

[Huawei-vlan3]port Ethernet 0/0/1 to 0/0/10

cisco交换指令

查看vlan列表

Switch#show vlan brief

VLAN Name Status Ports

1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4

 Fa0/5, Fa0/6, Fa0/7,

创建单个vlan

Switch(config)#vlan 2

Switch(config-vlan)#name xx

Switch(config-vlan)#exit

创建多个vlan

Switch(config)#vlan 2 to 10 ,11

划⼊单个接⼝

Switch(config)#interface f0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

划⼊多个接⼝

Switch(config)#interface range f0/1-10

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 3

创建vlan的第⼆种⽅式

Switch#vlan database

% Warning: It is recommended to configure VLAN from config mode,

 as VLAN database mode is being deprecated. Please consult user

 documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2

trunk⼲道的使⽤

默认trunk⼲道使⽤在sw-sw

 sw-router

作⽤承载所有的vlan

华为trunk配置

[Huawei]interface e0/0/1

[Huawei-Ethernet0/0/1]port link-type trunk

[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all

默认情况下华为只允许vlan1 通过,所以想让所有vlan通过必须有允许列表

cisco设备默认允许所有vlan通过,不⽤配置允许列表

配置trunk

Switch(config)#interface f0/1

Switch(config-if)#switchport mode trunk

允许列表

Switch(config-if)#switchport trunk allowed vlan 1 2

抑制列表

Switch(config-if)#switchport trunk allowed vlan remove 5

trunk的封装模式

isl (cisco私有) dot1q(公有封装)

可以保证数据的 占⽤资源少

完整性

20 4

⽀持所有链路层协议 。只⽀持tcp/ip⽹络

修改封装模式

修改默认vlan 修改本征vlan

华为设备

cisco设备

虚拟⼦接⼝

cisco指令 cisco路由器接⼝默认关闭必须⼿⼯开启

cisco的dhcp配置

acl 访问控制列表

acl是⼀张表

Switch(config)#interface f0/1

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#switchport mode trunk

[Huawei]interface e0/0/1

[Huawei-Ethernet0/0/1]port trunk pvid vlan 2

Switch(config)#interface f0/1

Switch(config-if)#switchport trunk native vlan 2

[Huawei]interface g0/0/0.1

[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 2

[Huawei-GigabitEthernet0/0/0.1]ip address 12.1.1.1 24

Router(config)#interface f0/0.2

Router(config-subif)#encapsulation dot1Q 3

Router(config-subif)#ip address 23.1.1.1 255.255.255.0

Router(config)#ip dhcp pool 1

Router(dhcp-config)#network 12.1.1.0 255.255.255.0

Router(dhcp-config)#default-router 12.1.1.1

Router(dhcp-config)#dns-server 8.8.8.8

acl有两个作⽤

1.控制流量

2.抓取感兴趣流量

acl有两个动作

1.permit 允许

2.deny 拒绝

acl分为

基本acl 2000-2999 CISCO 1-99

⾼级acl 3000-3999 cisco 100-199

⼆层acl 4000-4999

⾃定义acl

acl的匹配规则 从上往下依次匹配⼀旦匹配不再往下查询末尾隐藏拒绝所有(cisco)

华为末尾隐藏允许所有

基本acl 匹配源ip地址 使⽤位置靠近⽬标

⾼级acl 匹配源⽬ip地址上层协议

sy

Sysname r3

user-interface console 0

idle-timeout 0 0

cisco基本acl配置

Router(config)#access-list 1 deny 192.168.1.2 0.0.0.0

Router(config)#access-list 1 permit any

Router(config)#interface f0/1

Router(config-if)#ip access-group 1 out

1.⼦⽹划分使⽤172.16.0.0/16

2.r3456只有r6为dr 没有bdr

3.r4的换回不能宣告全⽹可达

4。加快收敛速度保证更新安全

  1. 尽量减少路由条⽬

hcia第六天

华为设备基本acl配置

[r3]acl 2000

[r3-acl-basic-2000]rule deny source 192.168.1.2 0.0.0.0

调用

[r3]interface g0/0/1

[r3-GigabitEthernet0/0/1]traffic-filter outbound acl 2000

查看acl

[r3]display acl all

 Total quantity of nonempty ACL number is 1

Basic ACL 2000, 1 rule

Acl's step is 5

 rule 5 deny source 192.168.1.2 0 (5 matches)

172.16.0.0/16

            01 000000

172.16.0.0/18 area 0

172.16.0.0/19 骨干

172.16.32.0/19 r3的环回地址

172.16.64.0/18 area 1

172.16.64.0/19 r1

172.16.64.0/20 骨干

172.16.80.0/20 环回

172.16.96.0/19 r2

172.16.96.0/20 骨干

172.16.112.0/20 环回

172.16.128.0/18 area 2

172.16.128.0/20 r4

172.16.128.0/21 r4的环回

172.16.136.0/21 r4-5的骨干

172.16.144.0/20 r5

172.16.144.0/21 r5的环回

172.16.152.0/21 r5-6的骨干

11110000

172.16.160.0/20r6的环回

高级acl 华为

范围3000-3999 检查源目ip地址上层协议

使用位置:靠近源 的位置

[r1]acl 3000

[r1-acl-adv-3000]rule deny ip source 34.1.1.2 0.0.0.0 destination 45.1.1.2 0.0.0

.0

调用

[r1]interface g0/0/0

[r1-GigabitEthernet0/0/0]traffic-filter inbound acl 3000

远程登录

[r3]user-interface vty 0 4

[r3-ui-vty0-4]authentication-mode password

Please configure the login password (maximum length 16):123

[r3-ui-vty0-4]user privilege level 15

使用用户名密码

[r3]aaa

[r3-aaa]local-user xx privilege level 15 password cipher yy

调用

[r3]user-interface vty 0 4

[r3-ui-vty0-4]authentication-mode aaa

干掉远程登录

[r2]acl 3000

[r2-acl-adv-3000]rule deny tcp source 12.1.1.1 0.0.0.0 destination 23.1.1.2 0.0.

0.0 destination-port eq telnet

ping不出去可以回ping

[r1-acl-adv-3000]rule deny icmp source 192.168.1.2 0.0.0.0 destination 172.16.1

.2 0.0.0.0 icmp-type echo

可以ping出去不能回ping

[r1-acl-adv-3000]rule deny icmp source 192.168.1.2 0.0.0.0 destination 172.16.1.

2 0.0.0.0 icmp-type echo-reply

acl的命名写法

[r1]acl name xx

[r1-acl-adv-xx]rule deny icmp source 1.1.1.1 0.0.0.0 destination 23.1.1.1 0.0.0.0

调用

[r1-GigabitEthernet0/0/1]traffic-filter inbound acl name xx

nat

一对一的nat 多用于转换内网服务器

[r2]interface g0/0/0

[r2-GigabitEthernet0/0/0]nat static global 11.1.1.3 inside 192.168.1.2

telnet转换

[r2-GigabitEthernet0/0/0]nat server protocol tcp global 11.1.1.3 telnet inside 23.1.1.2 telnet

多对多的nat

抓取感兴趣流量(抓内网流量)

[r2]acl 2000

[r2-acl-basic-2000]rule permit source any

抓取公网地址

nat address-group 1 11.1.1.4 11.1.1.5

多对多的nat转换

[r2]interface g0/0/0

[r2-GigabitEthernet0/0/0]nat outbound 2000 address-group 1

Easynat pat 多对一的nat

[r2]acl 2000

[r2-acl-basic-2000]rule permit source any

[r2]interface g0/0/0

[r2-GigabitEthernet0/0/0]nat outbound 2000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值