1004_23ensp笔记

文章讲述了在IT网络环境中,使用TCP和UDP协议的特性,配置VLAN和访问控制列表(ACL),以及如何通过交换机实现接口的access和trunk模式,以实现数据包隔离和带标签传输。实验中展示了VLAN如何隔离不同IP地址间的通信,以及TCP和UDP在网络中的应用实例。
摘要由CSDN通过智能技术生成

tcp&udp

tcp:可靠性高,适合文件完整性高的,但是对延迟不敏感
eg:email update客户端
udp:速度快,偶尔丢包
cdn:让不同人访问同一网址,返回不同ip。分散访问压力。


网路安全

vlan:虚拟局域网
acl:访问控制列表

text1:vlan隔离

设备:pc1&2、LSW1
pc1: ip 1.1.1.1 pc2: ip 1.1.1.2

交换机无配置下 1.测试pc1——>pc2

PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: bytes=32 seq=1 ttl=128 time=31 ms
From 1.1.1.2: bytes=32 seq=2 ttl=128 time=46 ms
From 1.1.1.2: bytes=32 seq=3 ttl=128 time=47 ms
From 1.1.1.2: bytes=32 seq=4 ttl=128 time=47 ms
From 1.1.1.2: bytes=32 seq=5 ttl=128 time=47 ms

--- 1.1.1.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/43/47 ms

2.设置交换机(创建vlan10&vlan20)

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10
[Huawei-vlan10]q
[Huawei]vlan 20
[Huawei-vlan20]
Oct  4 2023 17:15:37-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 5, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-vlan20]q
[Huawei]

查看交换机vlan

[Huawei]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/1(U)      GE0/0/2(U)      GE0/0/3(D)      GE0/0/4(D)      
                GE0/0/5(D)      GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)      
                GE0/0/9(D)      GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)     
                GE0/0/13(D)     GE0/0/14(D)     GE0/0/15(D)     GE0/0/16(D)     
                GE0/0/17(D)     GE0/0/18(D)     GE0/0/19(D)     GE0/0/20(D)     
                GE0/0/21(D)     GE0/0/22(D)     GE0/0/23(D)     GE0/0/24(D)     

10   common  
20   common  

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020

//{vlan1位默认vlan不需创建}

将g/0/0/1放入vlan10,g/0/0/2放入vlan20

[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access 
[Huawei-GigabitEthernet0/0/1]
Oct  4 2023 17:20:27-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 6, th
e change loop count is 0, and the maximum number of records is 4095.

//{将g/0/01接口类型设置为access}
//交换机接口模式:
access:表示用来连接终端的
trunk:用来连接其他交换机

[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei-GigabitEthernet0/0/1]
Oct  4 2023 17:24:27-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 7, th
e change loop count is 0, and the maximum number of records is 4095.

//将接口g0/0/1定义为vlan10

查看vlan划分

[Huawei]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/2(U)      GE0/0/3(D)      GE0/0/4(D)      GE0/0/5(D)      
                GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)      
                GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     
                GE0/0/14(D)     GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     
                GE0/0/18(D)     GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     
                GE0/0/22(D)     GE0/0/23(D)     GE0/0/24(D)                     

10   common  UT:GE0/0/1(U)                                                      

20   common  

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020

g0/0/2设置

[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access 
[Huawei-GigabitEthernet0/0/2]
Oct  4 2023 17:27:17-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 8, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]
Oct  4 2023 17:29:18-08:00 Huawei %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif1 h
as turned into DOWN state.
[Huawei-GigabitEthernet0/0/2]
Oct  4 2023 17:29:27-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 9, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/2]q
[Huawei]display vlan 
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/3(D)      GE0/0/4(D)      GE0/0/5(D)      GE0/0/6(D)      
                GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)      GE0/0/10(D)     
                GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     GE0/0/14(D)     
                GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     GE0/0/18(D)     
                GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     GE0/0/22(D)     
                GE0/0/23(D)     GE0/0/24(D)                                     

10   common  UT:GE0/0/1(U)                                                      

20   common  UT:GE0/0/2(U)                                                      


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020 

//两个接口均已分配vlan(已隔离)

验证:pc1->pc2

PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable

--- 1.1.1.2 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

text2:配置接口为trunk实现数据包携带标签

设备:text1+pc3&4+LSW2

配置LSW1 g0/0/3为trunk模式

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk     //接口类型定义为trunk
[Huawei-GigabitEthernet0/0/3]
Oct  4 2023 18:17:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 10, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all    //trunk接口允许所有vlan数据通过(实际工作中为vlan+number)
//{eg:port trunk allow-pass vlan 10/20 (可执行多条添加多个vlan)}	
[Huawei-GigabitEthernet0/0/3]
Oct  4 2023 18:18:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 11, t
he change loop count is 0, and the maximum number of records is 4095.

配置LSW2

[Huawei]vlan 10
[Huawei-vlan10]q
[Huawei]vlan 20
[Huawei-vlan20]q
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access 
[Huawei-GigabitEthernet0/0/2]
Oct  4 2023 18:23:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]
Oct  4 2023 18:25:09-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 7, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access 
[Huawei-GigabitEthernet0/0/3]
Oct  4 2023 18:25:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 8, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/3]port default vlan 20
[Huawei-GigabitEthernet0/0/3]
Oct  4 2023 18:26:09-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 9, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk 
[Huawei-GigabitEthernet0/0/1]
Oct  4 2023 18:30:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 10, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/1]
Oct  4 2023 18:31:20-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 11, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/1]
Oct  4 2023 18:31:30-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 12, t
he change loop count is 0, and the maximum number of records is 4095.

pc3&4配置

pc3 ip:1.1.1.3 pc4 ip:1.1.1.4

验证:

pc1->pc3(同属vlan10)
PC>ping 1.1.1.3

Ping 1.1.1.3: 32 data bytes, Press Ctrl_C to break
From 1.1.1.3: bytes=32 seq=1 ttl=128 time=79 ms
From 1.1.1.3: bytes=32 seq=2 ttl=128 time=62 ms
From 1.1.1.3: bytes=32 seq=3 ttl=128 time=62 ms
From 1.1.1.3: bytes=32 seq=4 ttl=128 time=62 ms
From 1.1.1.3: bytes=32 seq=5 ttl=128 time=94 ms

--- 1.1.1.3 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/71/94 ms
pc1->pc4(不同vlan)
PC>ping 1.1.1.4

Ping 1.1.1.4: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable
From 1.1.1.1: Destination host unreachable

--- 1.1.1.4 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss
pc2->pc4(同vlan 20)
PC>ping 1.1.1.4

Ping 1.1.1.4: 32 data bytes, Press Ctrl_C to break
From 1.1.1.4: bytes=32 seq=1 ttl=128 time=79 ms
From 1.1.1.4: bytes=32 seq=2 ttl=128 time=78 ms
From 1.1.1.4: bytes=32 seq=3 ttl=128 time=63 ms
From 1.1.1.4: bytes=32 seq=4 ttl=128 time=78 ms
From 1.1.1.4: bytes=32 seq=5 ttl=128 time=62 ms

--- 1.1.1.4 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/72/79 ms
pc2->pc3(不同vlan)
PC>ping 1.1.1.3

Ping 1.1.1.3: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: Destination host unreachable
From 1.1.1.2: Destination host unreachable
From 1.1.1.2: Destination host unreachable
From 1.1.1.2: Destination host unreachable
From 1.1.1.2: Destination host unreachable

--- 1.1.1.3 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

success!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值