Top

NTD TCNA DAY06

  1. 案例1:C类地址划分
  2. 案例2:子网划分与VLAN配置
  3. 案例3:IP地址汇总

1 案例1:C类地址划分

1.1 问题

C类地址192.168.55.0/24分别使用子网掩码/29和/30进行划分,划分后的子网和主机范围分别是什么?

1.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:C类地址192.168.55.0/24使用子网掩码/29进行划分
1)子网共32个,每个子网的可用主机数为6台
2)子网:192.168.55.0、192.168.55.8、……、192.168.55.248
3)主机范围:192.168.55.1~192.168.55.6、192.168.55.9~192.168.55.14、……、192.168.55.249~192.168.55.254
步骤二:C类地址192.168.55.0/24使用子网掩码/30进行划分
1)子网共64个,每个子网的可用主机数为2台
2)子网:192.168.55.0、192.168.55.4、……、192.168.55.252
3)主机范围:192.168.55.1~192.168.55.2、192.168.55.4~192.168.55.5、……、192.168.55.253~192.168.55.254

2 案例2:子网划分与VLAN配置

2.1 问题

公司网段192.168.22.0/24,生产部VLAN1有主机50台,销售部VLAN2有90台,
财务部VLAN3有15台,客服部VLAN4有26台,要求划分子网实现网络互通。

2.2 方案

使用eNSP搭建实验环境,如图-1所示。
TCNA DAY06 - 图1
图-1

2.3 步骤

实现此案例需要按照如下步骤进行。
步骤一:子网划分
子网划分结果如图-2所示。
TCNA DAY06 - 图2
图-2
步骤二:VLAN配置
1)配置SW3
[SW3]dis cu
#
sysname SW3
#
vlan batch 2 to 4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1 //为vlan设置IP地址
ip address 192.168.22.190 255.255.255.192
#
interface Vlanif2
ip address 192.168.22.126 255.255.255.128
#
interface Vlanif3
ip address 192.168.22.222 255.255.255.224
#
interface Vlanif4
ip address 192.168.22.254 255.255.255.224
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1 //设置trunk端口
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return

2)配置SW1
[SW1]dis cu
#
sysname SW1
#
vlan batch 2 to 4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type access
#
interface Ethernet0/0/2
port link-type access
port default vlan 2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return

3)配置SW2
[SW2]dis cu
#
sysname SW2
#
vlan batch 2 to 4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type access
port default vlan 3
#
interface Ethernet0/0/2
port link-type access
port default vlan 4
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return

4)配置主机并验证
VLAN 1主机配置如图-3所示。
TCNA DAY06 - 图3
图-3
VLAN 2主机配置如图-4所示。
TCNA DAY06 - 图4
图-4
VLAN 3主机配置如图-5所示。
TCNA DAY06 - 图5
图-5
VLAN 4主机配置如图-6所示。
TCNA DAY06 - 图6
图-6
验证四台主机均可以互相ping通。

3 案例3:IP地址汇总

3.1 问题

将下面IP地址段汇总成为一个地址段,要求汇总地址恰好包含所有地址,即要求汇总地址段子网掩码最长。

  1. 10.16.5.0/24、10.16.7.0/24、10.16.8.0/24
  2. 192.168.5.8/29、192.168.5.16/28

    3.2 步骤

    实现此案例需要按照如下步骤进行。
    1)10.16.0.0/20
  • 10.16.0000 0101.00000000/24
  • 10.16.0000 0111.00000000/24
  • 10.16.0000 1000.00000000/24

三个地址前20位完成相同,所以需要把前20位做为网络位,汇总后的结果:

  • 10.16.0000 0000.00000000/20
  • 10.16.0.0/20

2)192.168.5.0/27

  • 192.168.00000101.000 01000/29
  • 192.168.00000101.000 10000/28

二个地址前27位完成相同,所以需要把前27位做为网络位,汇总后的结果:

  • 192.168.00000101.000 00000/27
  • 192.168.5.0/27