路由器怎么设置DHCP服务
二层交换机:
[Huawei]sysname SW1
[SW1]vlan batch 2 3 100
[SW1]interface Ethernet0/0/1
[SW1] port link-type access
[SW1] port default vlan 2
[SW1] interface Ethernet0/0/2
[SW1] port link-type access
[SW1] port default vlan 3
[SW1] interface GigabitEthernet0/0/1
[SW1] port link-type trunk
[SW1] port trunk allow-pass vlan all
[SW1]interface GigabitEthernet0/0/2
[SW1] port link-type access
[SW1] port default vlan 100
三层交换机:
[Huawei]sysname SWR1
[SWR1] vlan batch 2 to 3 100
[SWR1] interface Vlanif 2
[SWR1] ip address 192.168.2.1 255.255.255.0
[SWR1] interface Vlanif 3
[SWR1] ip address 192.168.3.1 255.255.255.0
[SWR1] interface Vlanif 100
[SWR1] ip address 192.168.1.1 255.255.255.0
[SWR1] interface GigabitEthernet0/0/1
[SWR1] port link-type trunk
[SWR1] port trunk allow-pass vlan all
路由器:
[Huawei]sysname R1
[R1] interface GigabitEthernet0/0/0
[R1] ip address 192.168.1.100 255.255.255.0
[R1] ip route-static 192.168.2.0 255.255.255.0 192.168.1.1
[R1] ip route-static 192.168.3.0 255.255.255.0 192.168.1.1
DHPC 设置
路由器:
[R1]dhcp enable 开启dhcp功能
[R1] interface GigabitEthernet0/0/0
[R1] dhcp select global 设置为dhcp服务器
[R1] ip pool dhcp1
[R1-ip-pool-dhcp1]network 192.168.2.0 mask 255.255.255.0 设置dhcp网段
[R1-ip-pool-dhcp1] gateway-list 192.168.2.1 设置该网段网关
[R1-ip-pool-dhcp1] dns-list 2.2.2.2 4.4.4.4 设置DNS服务器IP地址
[R1-ip-pool-dhcp1]lease day 7 设置租期时间为7天
[R1] ip pool dhcp2
[R1-ip-pool-dhcp2]network 192.168.3.0 mask 255.255.255.0 设置dhcp网段
[R1-ip-pool-dhcp2] gateway-list 192.168.3.1 设置该网段网关
[R1-ip-pool-dhcp2] dns-list 3.3.3.3 5.5.5.5 设置DNS服务器IP地址
[R1-ip-pool-dhcp2]lease day 7 设置租期时间为7天
三层交换机(作为DHCP的中继):
[SWR1] dhcp enable 开启DHCP功能
[SWR1] interface Vlanif 2
[SWR1-Vlanif2]dhcp select relay 设置成为DHCP中继代理
[SWR1-Vlanif2] dhcp relay server-ip 192.168.1.100
用来配置DHCP中继所代理的DHCP服务器地址
[SWR1] interface Vlanif 3
[SWR1-Vlanif3]dhcp select relay 设置成为DHCP中继代理
[SWR1-Vlanif3] dhcp relay server-ip 192.168.1.100
用来配置DHCP中继所代理的DHCP服务器地址