1.实验拓扑
- 实验要求
1.全网可达
2.使用DHCP获取地址
- 实验思路
- 配置交换机,创建vlan,更改交换机的接口链路类型,配置trunk干道,放通vlan
- 配置路由器,配置DHCP服务,在子接口DHCP服务
- 实验步骤
- 创建vlan
[sw1]vlan 2
[sw1-vlan2]quit
[sw1]vlan 3
[sw1-vlan3]quit
[sw2]vlan 2
[sw2-vlan2]quit
[sw2]vlan 3
[sw2-vlan3]quit
[sw3]vlan 2
[sw3-vlan2]quit
[sw3]vlan 3
[sw3-vlan3]quit
- 更改接口链路类型,把接口加入到相应的vlan中.
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port
[sw1-Ethernet0/0/2]port lint
[sw1-Ethernet0/0/2]port link-type ac
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port de
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]quit
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port silk
[sw1-Ethernet0/0/3]port link-type ac
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port
[sw1-Ethernet0/0/3]port de
[sw1-Ethernet0/0/3]port default
[sw1-Ethernet0/0/3]port default vlan 3
[sw1]
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-ty
[sw1-Ethernet0/0/1]port link-type tr
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/1]port t
[sw1-Ethernet0/0/1]port trunk
[sw1-port-group-trunk]
[sw1-port-group-trunk]quit
[sw2]int e0/0/3
[sw2-Ethernet0/0/3]
[sw2-Ethernet0/0/3]port link-ty
[sw2-Ethernet0/0/3]port link-type
[sw2-port-group-link-type]port link-type ac
[sw2-port-group-link-type]port link-type access
[sw2-port-group-link-type]port de
[sw2-port-group-link-type]port default vlan 2
[sw2-port-group-link-type]quit
[sw2]int e0/0/4
[sw2-Ethernet0/0/4]port link-ty
[sw2-Ethernet0/0/4]port link-type ac
[sw2-Ethernet0/0/4]port link-type access
[sw2-Ethernet0/0/4]port de
[sw2-Ethernet0/0/4]port default vlan 3
[sw2-Ethernet0/0/4]quit
[sw3]int e0/0/2
[sw3-Ethernet0/0/2]port link-ty
[sw3-Ethernet0/0/2]port link-type ac
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]port de
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]quit
[sw3]int e0/0/3
[sw3-Ethernet0/0/3]port link-ty
[sw3-Ethernet0/0/3]port link-type ac
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]
[sw3-Ethernet0/0/3]port de
[sw3-Ethernet0/0/3]port default vlan 3
[sw3-Ethernet0/0/3]
[sw3-Ethernet0/0/3]quit
- 放通vlan
[sw1-Ethernet0/0/1]port tr
[sw1-Ethernet0/0/1]port trunk ai
[sw1-Ethernet0/0/1]port trunk al
[sw1-Ethernet0/0/1]port trunk allow-pass vlan ?
INTEGER<1-4094> VLAN ID
all All
[sw1-Ethernet0/0/1]port trunk allow-pass vlan
[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw1-Ethernet0/0/1]quit
[sw1]
dis port vlan active 可检查放通情况
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-ty
[sw2-Ethernet0/0/2]port link-type tr
[sw2-Ethernet0/0/2]port link-type trunk
[sw2-Ethernet0/0/2]port t
[sw2-Ethernet0/0/2]port trunk al
[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3
[sw2-Ethernet0/0/2]quit
[sw2]
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]dis th
[sw2-Ethernet0/0/1]dis this
#
interface Ethernet0/0/1
#
return
[sw2-Ethernet0/0/1]port link-ty
[sw2-Ethernet0/0/1]port link-type tr
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]
[sw2-Ethernet0/0/1]port trunk al
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-ty
[sw3-Ethernet0/0/1]port link-type tr
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port t
[sw3-Ethernet0/0/1]port trunk al
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3
- 实验拓扑
- 实验要求
1.全网可达
2.使用DHCP获取地址
- 实验思路
- 配置交换机,创建vlan,更改交换机的接口链路类型,配置trunk干道,放通vlan
- 配置路由器,配置DHCP服务,在子接口DHCP服务
- 实验步骤
- 创建vlan
[sw1]vlan 2
[sw1-vlan2]quit
[sw1]vlan 3
[sw1-vlan3]quit
[sw2]vlan 2
[sw2-vlan2]quit
[sw2]vlan 3
[sw2-vlan3]quit
[sw3]vlan 2
[sw3-vlan2]quit
[sw3]vlan 3
[sw3-vlan3]quit
- 更改接口链路类型,把接口加入到相应的vlan中.
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port
[sw1-Ethernet0/0/2]port lint
[sw1-Ethernet0/0/2]port link-type ac
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port de
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]quit
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port silk
[sw1-Ethernet0/0/3]port link-type ac
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port
[sw1-Ethernet0/0/3]port de
[sw1-Ethernet0/0/3]port default
[sw1-Ethernet0/0/3]port default vlan 3
[sw1]
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-ty
[sw1-Ethernet0/0/1]port link-type tr
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/1]port t
[sw1-Ethernet0/0/1]port trunk
[sw1-port-group-trunk]
[sw1-port-group-trunk]quit
[sw2]int e0/0/3
[sw2-Ethernet0/0/3]
[sw2-Ethernet0/0/3]port link-ty
[sw2-Ethernet0/0/3]port link-type
[sw2-port-group-link-type]port link-type ac
[sw2-port-group-link-type]port link-type access
[sw2-port-group-link-type]port de
[sw2-port-group-link-type]port default vlan 2
[sw2-port-group-link-type]quit
[sw2]int e0/0/4
[sw2-Ethernet0/0/4]port link-ty
[sw2-Ethernet0/0/4]port link-type ac
[sw2-Ethernet0/0/4]port link-type access
[sw2-Ethernet0/0/4]port de
[sw2-Ethernet0/0/4]port default vlan 3
[sw2-Ethernet0/0/4]quit
[sw3]int e0/0/2
[sw3-Ethernet0/0/2]port link-ty
[sw3-Ethernet0/0/2]port link-type ac
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]port de
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]quit
[sw3]int e0/0/3
[sw3-Ethernet0/0/3]port link-ty
[sw3-Ethernet0/0/3]port link-type ac
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]
[sw3-Ethernet0/0/3]port de
[sw3-Ethernet0/0/3]port default vlan 3
[sw3-Ethernet0/0/3]
[sw3-Ethernet0/0/3]quit
- 放通vlan
[sw1-Ethernet0/0/1]port tr
[sw1-Ethernet0/0/1]port trunk ai
[sw1-Ethernet0/0/1]port trunk al
[sw1-Ethernet0/0/1]port trunk allow-pass vlan ?
INTEGER<1-4094> VLAN ID
all All
[sw1-Ethernet0/0/1]port trunk allow-pass vlan
[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw1-Ethernet0/0/1]quit
[sw1]
dis port vlan active 可检查放通情况
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-ty
[sw2-Ethernet0/0/2]port link-type tr
[sw2-Ethernet0/0/2]port link-type trunk
[sw2-Ethernet0/0/2]port t
[sw2-Ethernet0/0/2]port trunk al
[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3
[sw2-Ethernet0/0/2]quit
[sw2]
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]dis th
[sw2-Ethernet0/0/1]dis this
#
interface Ethernet0/0/1
#
return
[sw2-Ethernet0/0/1]port link-ty
[sw2-Ethernet0/0/1]port link-type tr
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]
[sw2-Ethernet0/0/1]port trunk al
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-ty
[sw3-Ethernet0/0/1]port link-type tr
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port t
[sw3-Ethernet0/0/1]port trunk al
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3
- 配路由器
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.2]
[R1-GigabitEthernet0/0/0.2]
[R1-GigabitEthernet0/0/0.2]do
[R1-GigabitEthernet0/0/0.2]dot1q
[R1-GigabitEthernet0/0/0.2]dot1q ter
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 2
dot1q termination vid可开启识别vlan的功能
arp broadcast enable实现广播允许子接口向物理口记住mac地址
[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.3]
[R1-GigabitEthernet0/0/0.3]dou
[R1-GigabitEthernet0/0/0.3]dot
[R1-GigabitEthernet0/0/0.3]dot1q ter
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 3
Jan 17 2024 01:35:30-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.3 has entered the UP state.
[R1-GigabitEthernet0/0/0.3]
[R1-GigabitEthernet0/0/0.3]arp b
[R1-GigabitEthernet0/0/0.3]arp broadcast en
[R1-GigabitEthernet0/0/0.3]arp broadcast enable
[R1-GigabitEthernet0/0/0.3]quit
[R1]
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]ip add 192.168.3.254 24
[R1-GigabitEthernet0/0/1.2]do
[R1-GigabitEthernet0/0/1.2]dot1q ter
[R1-GigabitEthernet0/0/1.2]dot1q termination vid 2
[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]ip add 192.168.4.254 24
[R1-GigabitEthernet0/0/1.3]
[R1-GigabitEthernet0/0/1.3]do
[R1-GigabitEthernet0/0/1.3]dot1q ter
[R1-GigabitEthernet0/0/1.3]dot1q termination vid 3
[R1-GigabitEthernet0/0/1.3]arp b
[R1-GigabitEthernet0/0/1.3]arp broadcast en
[R1-GigabitEthernet0/0/1.3]arp broadcast enable
[R1-GigabitEthernet0/0/1.3]quit
在路由器上配置DRCP服务
[R1]dhcp en
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
后创建地址池
[R1]ip pool aa
Info: It's successful to create an IP address pool.
[R1-ip-pool-aa]
[R1-ip-pool-aa]
[R1-ip-pool-aa]netw
[R1-ip-pool-aa]network 192.168.1.0 mask 24
[R1-ip-pool-aa]
网关地址和DHCP服务器地址
[R1-ip-pool-aa]
网关:[R1-ip-pool-aa]ga
[R1-ip-pool-aa]gateway-list 192.168.1.254
[R1-ip-pool-aa]dn
DHCP服务器地址:[R1-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-aa]quit
[R1]
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp se
[R1-GigabitEthernet0/0/0.2]dhcp select g
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1-GigabitEthernet0/0/0.2]quit
[R1]ip pool bb
Info: It's successful to create an IP address pool.
[R1-ip-pool-bb]ga
[R1-ip-pool-bb]net
[R1-ip-pool-bb]netw
[R1-ip-pool-bb]network 192.168.2.0 mask 24
[R1-ip-pool-bb]ga
[R1-ip-pool-bb]gateway-list 192.168.2.254
[R1-ip-pool-bb]de
[R1-ip-pool-bb]dn
[R1-ip-pool-bb]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-bb]quit
[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]dhcp se
[R1-GigabitEthernet0/0/0.3]dhcp select g
R1]ip pool cc
Info: It's successful to create an IP address pool.
[R1-ip-pool-cc]netw
[R1-ip-pool-cc]network 192.168.3.0 mask 24
[R1-ip-pool-cc]ga
[R1-ip-pool-cc]gateway-list 192.168.3.254
[R1-ip-pool-cc]dn
[R1-ip-pool-cc]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-cc]quit
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp se
[R1-GigabitEthernet0/0/1.2]dhcp select g
[R1-GigabitEthernet0/0/1.2]dhcp select global
[R1-GigabitEthernet0/0/1.2]quit
[R1]
经检测PC之间可通.