Не сложно, конечно!
Схема подключения: Роутер 3612. В 9 порт этого роутера подключен DHCP сервер, из 12 порта уходит линк в 25 порт свитча 3526, из 26 порта свитча 3526 уходит линк в 28 порт свитча 3028. На 3612 созданы виланы и интерфейсы:
Код:
main - 10.1.2.254/24
dhcp2 - 10.11.11.254/24
dhcp3 - 10.12.12.254/24
dhcp4 - 10.13.13.254/24
dhcp5 - 10.14.14.254/24
На свитч 3526 прокинуты виланы main, dhcp2, dhcp3, dhcp4. На свитч 3028 прокинуты виланы main, dhcp5.
Код:
IP роутера 3612 - 10.1.2.254
IP свитча 3526 - 10.1.2.253
IP свичта 3028 - 10.1.2.252
IP DHCP - сервера - 10.1.2.30
Для реализации схемы нужно на всех свитчах опции dhcp_relay и dhcp_local_relay поставить в режим disable. А на роутере 3612 включить dhcp_relay. При этом, для всех интерфейсов на роутере 3612 нужно сделать:
Код
config dhcp_relay add ipif имя_интерфейса 10.1.2.30
Приведу вывод основных команд:
Роутер 3612:
Код:
Command: show vlan
VID : 1 VLAN Name : default
VLAN Type : Static Advertisement : Enabled
Member Ports :
Static Ports :
Current Tagged Ports :
Current Untagged Ports:
Static Tagged Ports :
Static Untagged Ports :
Forbidden Ports :
VID : 2 VLAN Name : dhcp
VLAN Type : Static Advertisement : Disabled
Member Ports : 12
Static Ports : 12
Current Tagged Ports : 12
Current Untagged Ports:
Static Tagged Ports : 12
Static Untagged Ports :
Forbidden Ports :
VID : 3 VLAN Name : dhcp2
VLAN Type : Static Advertisement : Disabled
Member Ports : 11-12
Static Ports : 11-12
Current Tagged Ports : 11-12
Current Untagged Ports:
Static Tagged Ports : 11-12
Static Untagged Ports :
Forbidden Ports :
VID : 4 VLAN Name : dhcp3
VLAN Type : Static Advertisement : Disabled
Member Ports : 11-12
Static Ports : 11-12
Current Tagged Ports : 11-12
Current Untagged Ports:
Static Tagged Ports : 11-12
Static Untagged Ports :
Forbidden Ports :
VID : 5 VLAN Name : dhcp4
VLAN Type : Static Advertisement : Disabled
Member Ports : 11-12
Static Ports : 11-12
Current Tagged Ports : 11-12
Current Untagged Ports:
Static Tagged Ports : 11-12
Static Untagged Ports :
Forbidden Ports :
VID : 6 VLAN Name : dhcp5
VLAN Type : Static Advertisement : Disabled
Member Ports : 11-12
Static Ports : 11-12
Current Tagged Ports : 11-12
Current Untagged Ports:
Static Tagged Ports : 11-12
Static Untagged Ports :
Forbidden Ports :
VID : 10 VLAN Name : main
VLAN Type : Static Advertisement : Disabled
Member Ports : 9-12
Static Ports : 9-12
Current Tagged Ports : 11-12
Current Untagged Ports: 9-10
Static Tagged Ports : 11-12
Static Untagged Ports : 9-10
Forbidden Ports :
Total Entries: 7
Код:
DGS-3612G:5#show ipif
Command: show ipif
IP Interface : dhcp
VLAN Name : dhcp
Interface Admin state : Enabled
IPv4 Address : 10.10.10.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : main
VLAN Name : main
Interface Admin state : Enabled
IPv4 Address : 10.1.2.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : dhcp2
VLAN Name : dhcp2
Interface Admin state : Enabled
IPv4 Address : 10.11.11.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : dhcp3
VLAN Name : dhcp3
Interface Admin state : Enabled
IPv4 Address : 10.12.12.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : dhcp4
VLAN Name : dhcp4
Interface Admin state : Enabled
IPv4 Address : 10.13.13.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : dhcp5
VLAN Name : dhcp5
Interface Admin state : Enabled
IPv4 Address : 10.14.14.254/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
IP Interface : System
VLAN Name : default
Interface Admin state : Enabled
IPv4 Address : 10.20.30.40/24 (Manual) Primary
Proxy ARP : Disabled (Local : Disabled)
IP MTU : 1500
Total Entries : 7
Код:
DGS-3612G:5#show dhcp_relay
Command: show dhcp_relay
DHCP/Bootp Relay Status : Enabled
DHCP/Bootp Hops Count Limit : 4
DHCP/Bootp Relay Time Threshold : 0 second(s)
DHCP Relay Agent Information Option 82 State : Disabled
DHCP Relay Agent Information Option 82 Check : Disabled
DHCP Relay Agent Information Option 82 Policy : Replace
Interface Server 1 Server 2 Server 3 Server 4
------------ --------------- --------------- --------------- ---------------
main 10.1.2.30
dhcp2 10.1.2.30
dhcp3 10.1.2.30
dhcp4 10.1.2.30
dhcp5 10.1.2.30
System 10.1.2.30
Свитч 3526:
Код:
Command: show vlan
VID : 1 VLAN Name : default
VLAN TYPE : static Advertisement : Enabled
Member ports :
Static ports :
Current Tagged ports :
Current Untagged ports :
Static Tagged ports :
Static Untagged ports :
Forbidden ports :
VID : 3 VLAN Name : dhcp2
VLAN TYPE : static Advertisement : Disabled
Member ports : 1-5,25-26
Static ports : 1-5,25-26
Current Tagged ports : 25-26
Current Untagged ports : 1-5
Static Tagged ports : 25-26
Static Untagged ports : 1-5
Forbidden ports :
VID : 4 VLAN Name : dhcp3
VLAN TYPE : static Advertisement : Disabled
Member ports : 6-10,25-26
Static ports : 6-10,25-26
Current Tagged ports : 25-26
Current Untagged ports : 6-10
Static Tagged ports : 25-26
Static Untagged ports : 6-10
Forbidden ports :
VID : 5 VLAN Name : dhcp4
VLAN TYPE : static Advertisement : Disabled
Member ports : 11-15,25-26
Static ports : 11-15,25-26
Current Tagged ports : 25-26
Current Untagged ports : 11-15
Static Tagged ports : 25-26
Static Untagged ports : 11-15
Forbidden ports :
VID : 6 VLAN Name : dhcp5
VLAN TYPE : static Advertisement : Disabled
Member ports : 25-26
Static ports : 25-26
Current Tagged ports : 25-26
Current Untagged ports :
Static Tagged ports : 25-26
Static Untagged ports :
Forbidden ports :
VID : 10 VLAN Name : main
VLAN TYPE : static Advertisement : Disabled
Member ports : 25-26
Static ports : 25-26
Current Tagged ports : 25-26
Current Untagged ports :
Static Tagged ports : 25-26
Static Untagged ports :
Forbidden ports :
Total Entries : 6
Код:
Command: show ipif
IP Interface Settings
Interface Name : System
IP Address : 10.1.2.253 (MANUAL)
Subnet Mask : 255.255.255.0
VLAN Name : main
Admin. State : Enabled
Link Status : Link UP
Member Ports : 25-26
Total Entries : 1
Код:
Command: show dhcp_local_relay
DHCP/BOOTP Local Relay Status : Disabled
DHCP/BOOTP Local Relay VLAN List :
DES-3526:admin#show dhcp_relay
Command: show dhcp_relay
DHCP/BOOTP Relay Status : Disabled
DHCP/BOOTP Hops Count Limit : 4
DHCP/BOOTP Relay Time Threshold : 0
DHCP Relay Agent Information Option 82 State : Disabled
DHCP Relay Agent Information Option 82 Check : Disabled
DHCP Relay Agent Information Option 82 Policy : Replace
DHCP Relay Agent Information Option 82 Remote ID : 00-17-9A-BB-D5-BF
Interface Server 1 Server 2 Server 3 Server 4
------------ --------------- --------------- --------------- --------------
System 10.1.2.30
Свитч 3028:
Код:
DES-3028:4#show vlan
Command: show vlan
VID : 1 VLAN Name : default
VLAN Type : Static Advertisement : Enabled
Member Ports :
Static Ports :
Current Tagged Ports :
Current Untagged Ports :
Static Tagged Ports :
Static Untagged Ports :
Forbidden Ports :
VID : 6 VLAN Name : dhcp5
VLAN Type : Static Advertisement : Disabled
Member Ports : 1-10,27-28
Static Ports : 1-10,27-28
Current Tagged Ports : 27-28
Current Untagged Ports : 1-10
Static Tagged Ports : 27-28
Static Untagged Ports : 1-10
Forbidden Ports :
VID : 10 VLAN Name : main
VLAN Type : Static Advertisement : Disabled
Member Ports : 28
Static Ports : 28
Current Tagged Ports : 28
Current Untagged Ports :
Static Tagged Ports : 28
Static Untagged Ports :
Forbidden Ports :
Total Entries : 3
Код:
DES-3028:4#show ipif
Command: show ipif
IP Interface Settings
Interface Name : System
IP Address : 10.1.2.252 (MANUAL)
Subnet Mask : 255.255.255.0
VLAN Name : main
Admin. State : Enabled
Link Status : Link UP
Member Ports : 28
Total Entries : 1
Код:
DES-3028:4#show dhcp_relay
Command: show dhcp_relay
DHCP/BOOTP Relay Status : Disabled
DHCP/BOOTP Hops Count Limit : 4
DHCP/BOOTP Relay Time Threshold : 0
DHCP Relay Agent Information Option 82 State : Disabled
DHCP Relay Agent Information Option 82 Check : Disabled
DHCP Relay Agent Information Option 82 Policy : Replace
DHCP Relay Agent Information Option 82 Remote ID : 00-1E-58-AE-D2-83
Interface Server 1 Server 2 Server 3 Server 4
------------ --------------- --------------- --------------- --------------
DES-3028:4#show dhcp_local_relay
Command: show dhcp_local_relay
DHCP/BOOTP Local Relay Status : Disabled
DHCP/BOOTP Local Relay VID LIST : -
Конфиг dhcpd.conf:
Код:
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
option domain-name "vltele.com";
option domain-name-servers 80.244.224.250;
default-lease-time 120;
max-lease-time 120;
# local address
local-address 10.1.2.30;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates
ddns-update-style none;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection)
log-facility local7;
#if option 82 comes
if exists agent.circuit-id
{
log (info, concat ("Lease for",
binary-to-ascii (10, 8, ".",leased-address),
"Switch port: ",
binary-to-ascii (10, 8, ".", option agent.circuit-id),
"Switch MAC: ",
binary-to-ascii (16, 8, ".", option agent.remote-id)));
}
##################################################
subnet 10.0.0.0 netmask 255.0.0.0 {
class "test"
{
match if binary-to-ascii(10, 8, ".", packet (24, 4))="10.13.13.254";
}
pool {
range 10.13.13.133;
option routers 10.13.13.254;
option subnet-mask 255.255.255.0;
allow members of "test";
}
class "test2"
{
match if binary-to-ascii(10, 8, ".", packet (24, 4))="10.12.12.254";
}
pool {
range 10.12.12.122;
option routers 10.12.12.254;
option subnet-mask 255.255.255.0;
allow members of "test2";
}
class "test3"
{
match if binary-to-ascii(10, 8, ".", packet (24, 4))="10.14.14.254";
}
pool {
range 10.14.14.144 10.14.14.154;
option routers 10.14.14.254;
option subnet-mask 255.255.255.0;
allow members of "test3";
}
}
###########################################
В итоге абоненты получают айпи адреса.