DHCP服务,华为交换机中继DHCP实现PC的IP地址动态获取

一、需求:

实现PC通过DHCP动态获取地址参数

二、配置思路

1.配置交换机

  --所有交换机创建VLAN10、20、30、40、66

  --配置access

  --配置trunk

2.配置路由

  --配置三层接口地址

  --三层交换机SW6

  --DHCP服务器配置默认路由

3.配置DHCP服务器

  --启动DHCP服务

  --配置DHCP地址池

  --接口下开启DHCP功能

4.配置DHCP中继

  --启动DHCP功能

  --与终端相连接口开启中继功能

  --指定服务器地址

三、搭建网络拓结构图扑如下

c68bccb688334f36a65fb20d8b2cc94d.png

使用的设备AR2220、S5700、PC

一、交换机配置
1.SW1的配置
[Huawei]sysname SW1

[SW1]undo info-center enable

[SW1]vlan batch 10 20 30 40 66

[SW1]interface GigabitEthernet0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]quit

[SW1]interface GigabitEthernet0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1-GigabitEthernet0/0/2]quit

[SW1]interface GigabitEthernet0/0/6
[SW1-GigabitEthernet0/0/6]port link-type trunk
[SW1-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/6]quit

2.SW2的配置
[Huawei]sysname SW2

[SW2]undo info-center enable

[SW2]vlan batch 10 20 30 40 66

[SW2]interface GigabitEthernet0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 10
[SW2-GigabitEthernet0/0/1]quit

[SW2]interface GigabitEthernet0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 30
[SW2-GigabitEthernet0/0/2]quit

[SW2]interface GigabitEthernet0/0/6
[SW2-GigabitEthernet0/0/6]port link-type trunk
[SW2-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/6]quit

3.SW3的配置
sysname SW3

undo info-center enable

vlan batch 10 20 30 40 66

[SW3]interface GigabitEthernet0/0/1
[SW3-GigabitEthernet0/0/1]port link-type access
[SW3-GigabitEthernet0/0/1]port default vlan 20
[SW3-GigabitEthernet0/0/1]quit

[SW3]interface GigabitEthernet0/0/2
[SW3-GigabitEthernet0/0/2]port link-type access
[SW3-GigabitEthernet0/0/2]port default vlan 40
[SW3-GigabitEthernet0/0/2]quit

[SW3]interface GigabitEthernet0/0/6
[SW3-GigabitEthernet0/0/6]port link-type trunk
[SW3-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/6]quit

4.SW4的配置
sysname SW4

undo info-center enable

vlan batch 10 20 30 40 66

[SW4]interface GigabitEthernet0/0/1
[SW4-GigabitEthernet0/0/1]port link-type access
[SW4-GigabitEthernet0/0/1]port default vlan 40
[SW4-GigabitEthernet0/0/1]quit

[SW4]interface GigabitEthernet0/0/2
[SW4-GigabitEthernet0/0/2]port link-type access
[SW4-GigabitEthernet0/0/2]port default vlan 30
[SW4-GigabitEthernet0/0/2]quit

[SW4]interface GigabitEthernet0/0/3
[SW4-GigabitEthernet0/0/3]port link-type trunk
[SW4-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[SW4-GigabitEthernet0/0/3]quit

[SW4]interface GigabitEthernet0/0/6
[SW4-GigabitEthernet0/0/6]port link-type trunk
[SW4-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW4-GigabitEthernet0/0/6]quit

5.SW6的配置
sysname SW6

undo info-center enable

vlan batch 10 20 30 40 66

[SW6]interface GigabitEthernet0/0/1
[SW6-GigabitEthernet0/0/1]port link-type trunk
[SW6-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW6-GigabitEthernet0/0/1]quit

[SW6]interface GigabitEthernet0/0/2
[SW6-GigabitEthernet0/0/2]port link-type trunk
[SW6-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW6-GigabitEthernet0/0/2]quit

[SW6]interface GigabitEthernet0/0/3
[SW6-GigabitEthernet0/0/3]port link-type trunk
[SW6-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW6-GigabitEthernet0/0/3]quit

[SW6]interface GigabitEthernet0/0/4
[SW6-GigabitEthernet0/0/4]port link-type trunk
[SW6-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW6-GigabitEthernet0/0/4]quit

[SW6]interface GigabitEthernet0/0/5
[SW6-GigabitEthernet0/0/5]port link-type trunk
[SW6-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[SW6-GigabitEthernet0/0/5]quit

interface Vlanif10
ip address 192.168.10.254 255.255.255.0

interface Vlanif20
ip address 192.168.20.254 255.255.255.0

interface Vlanif30
ip address 192.168.30.254 255.255.255.0

interface Vlanif40
ip address 192.168.40.254 255.255.255.0

interface Vlanif66
ip address 192.168.66.254 255.255.255.0


#开启DHCP服务,配置DHCP中继

dhcp enable

interface Vlanif10
dhcp select relay     #DHCP选择中继模式
dhcp relay server-ip 192.168.66.1   #指定DHCP服务器IP地址

interface Vlanif20
dhcp select relay 
dhcp relay server-ip 192.168.66.1

interface Vlanif30
dhcp select relay 
dhcp relay server-ip 192.168.66.1

interface Vlanif40
dhcp select relay 
dhcp relay server-ip 192.168.66.1


6.SW10的配置
sysname SW10

undo info-center enable

vlan batch 10 20 30 40 66

[SW10]interface GigabitEthernet0/0/1
[SW10-GigabitEthernet0/0/1]port link-type access
[SW10-GigabitEthernet0/0/1]port default vlan 66
[SW10-GigabitEthernet0/0/1]quit

[SW10]interface GigabitEthernet0/0/6
[SW10-GigabitEthernet0/0/6]port link-type trunk
[SW10-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW10-GigabitEthernet0/0/6]quit

[SW10]interface GigabitEthernet0/0/10 
[SW10-GigabitEthernet0/0/10]port link-type trunk
[SW10-GigabitEthernet0/0/10]port trunk allow-pass vlan all
[SW10-GigabitEthernet0/0/10]quit

二、路由器配置
sysname DHCP

undo info-center enable

interface GigabitEthernet0/0/0
ip address 192.168.66.1 255.255.255.0

ip route-static 0.0.0.0 0.0.0.0 192.168.66.254

dhcp enable

ip pool 1
gateway-list 192.168.10.254 
network 192.168.10.0 mask 255.255.255.0 
dns-list 114.114.114.114 

ip pool 2
gateway-list 192.168.20.254 
network 192.168.20.0 mask 255.255.255.0 
dns-list 114.114.114.114 

ip pool 3
gateway-list 192.168.30.254 
network 192.168.30.0 mask 255.255.255.0 
dns-list 114.114.114.114 

ip pool 4
gateway-list 192.168.40.254 
network 192.168.40.0 mask 255.255.255.0 
dns-list 114.114.114.114 

interface GigabitEthernet0/0/0
dhcp select global

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值