【无标题】

发布于:2025-07-17 ⋅ 阅读:(23) ⋅ 点赞:(0)

二:

  1. 实现全网可达。
  2. 使所有 PC 通过 DHCP 获取 IP 地址

三:

1、划分地址、进行地址配置
2、vlan 配置
划分 vlan;
更改接口的链路类型,将相应的接口加入 vlan;
在 trunk 链路上放行网络中的 vlan
3、配置子接口;
4、DHCP 配置

四:

1:

  • VLAN 划分
    • 左边(SW1、SW2):
      • VLAN 2:192.168.1.0/24
      • VLAN 3:192.168.2.0/24
    • 右边(SW3):
      • VLAN 2:192.168.3.0/24
      • VLAN 3:192.168.4.0/24

2.vlan配置

slw1:

# 创建VLAN 2和VLAN 3
vlan 2
vlan 3

# 将接口加入VLAN
interface Ethernet 0/0/2
port link-type access
port default vlan 2

interface Ethernet 0/0/3
port link-type access
port default vlan 3

# 配置Trunk接口(连接SW2)
interface Ethernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 2 3

slw2:

# 创建VLAN 2和VLAN 3
vlan 2
vlan 3

# 将接口加入VLAN
interface Ethernet 0/0/3
port link-type access
port default vlan 2

interface Ethernet 0/0/4
port link-type access
port default vlan 3

# 配置Trunk接口(连接SW1)
interface Ethernet 0/0/2
port link-type trunk
port trunk allow-pass vlan 2 3

# 配置Trunk接口(连接R1)
interface Ethernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 2 3

slw3:

# 创建VLAN 2和VLAN 3
vlan 2
vlan 3

# 将接口加入VLAN
interface Ethernet 0/0/2
port link-type access
port default vlan 2

interface Ethernet 0/0/3
port link-type access
port default vlan 3

# 配置Trunk接口(连接R1)
interface Ethernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 2 3

3.R2接口配置虚拟接口

interface GigabitEthernet0/0/0.2
 dot1q termination vid 2
 ip address 192.168.1.254 255.255.255.0 
 arp broadcast enable

#

interface GigabitEthernet0/0/0.3
 dot1q termination vid 3
 ip address 192.168.2.254 255.255.255.0 
 arp broadcast enable

#

interface GigabitEthernet0/0/1.2
 dot1q termination vid 2
 ip address 192.168.3.254 255.255.255.0 
 arp broadcast enable

#

interface GigabitEthernet0/0/1.3
 dot1q termination vid 3
 ip address 192.168.4.254 255.255.255.0 
 arp broadcast enable

#

4.dhcp配置


dhcp enable
#
ip pool A
 gateway-list 192.168.1.254 
 network 192.168.1.0 mask 255.255.255.0 
 dns-list 8.8.8.8 114.114.114.114 
#
ip pool B
 gateway-list 192.168.2.254 
 network 192.168.2.0 mask 255.255.255.0 
 dns-list 8.8.8.8 114.114.114.114 
#
ip pool C
 gateway-list 192.168.3.254 
 network 192.168.3.0 mask 255.255.255.0 
 dns-list 8.8.8.8 114.114.114.114 
#
ip pool D
 gateway-list 192.168.4.254 
 network 192.168.4.0 mask 255.255.255.0 
 dns-list 8.8.8.8 114.114.114.114 
#

5.在r1的虚拟接口上启动dhcp

dhcp select global

五:验证

1.slw的配置vlan

dhcp:

ping 测试


网站公告

今日签到

点亮在社区的每一天
去签到