カテゴリ:

今回はDHCPサーバを異なるネットワークに置いた場合の設定を確認します。ip helper-addressコマンドを使いますが、どこにコマンドを適用するのか、慣れないと迷います。

R2はR1(F0/0)とR3(S1/3)にそれぞれ直結しています。ここではR3をDHCPサーバとし、R1のインターフェースをDHCPクライアントとします。

R2(config)#do sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.2      YES manual up                    up
Serial1/2                  23.23.23.2      YES manual up                    up
Loopback0                  17.17.2.2       YES NVRAM  up                    up

R3(config)#do sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
Serial1/3                  23.23.23.3      YES manual up                    up
Loopback0                  17.17.3.3       YES NVRAM  up                    up

まず前回を参考にR3にDHCPサーバの設定を行います。

R3(config)#ip dhcp pool MYDHCP

R3(dhcp-config)#network 12.12.12.0 /24
R3(dhcp-config)#exit
R3(config)#ip dhcp excluded-address 12.12.12.0 12.12.12.99
R3(config)#do deb ip dhcp server event
R3(config)#do sh ip dhcp pool MYDHCP

Pool MYDHCP :
Utilization mark (high/low)    : 100 / 0
Subnet size (first/next)       : 0 / 0
Total addresses                : 254
Leased addresses               : 0
Pending event                  : none
1 subnet is currently in the pool :
Current index        IP address range                    Leased addresses
12.12.12.1           12.12.12.1       - 12.12.12.254      0

ここでR1のF0/0でDHCPを有効にします。

R1(config)#int f0/0
R1(config-if)#ip address dhcp
R1(config-if)#no sh

有効にしてもDHCPによるIPアドレスの割り当ては行われません。これは23.23.23.0/24にあるDHCPサーバまでBOOTPパケットが転送されないからです。

R1(config-if)#do sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES DHCP   up                    up

BOOTPパケットの転送を行うためにip helper-addressコマンドを利用しますが、設定するのはBOOTPパケットを受け取るインターフェースになります(この場合、R1のF0/0に直結しているR2のF0/0)。

R2(config)#int f0/0
R2(config-if)#ip helper-address 23.23.23.3
R2(config-if)#do sh ip int f0/0 | i Help
  Helper address is 23.23.23.3

設定後、しばらくするとR3に反応が出ます。

Oct 30 06:21:54.383: DHCPD: Adding binding to radix tree (12.12.12.100)
Oct 30 06:21:54.383: DHCPD: Adding binding to hash tree
Oct 30 06:21:54.387: DHCPD: assigned IP address 12.12.12.100 to client 0063.6973.636f.2d63.3230.302e.3165.3633.2e30.3030.302d.4661.302f.30.
Oct 30 06:21:54.427: DHCPD: Sending notification of ASSIGNMENT:
Oct 30 06:21:54.427:  DHCPD: address 12.12.12.100 mask 255.255.255.0

R3(config)#do sh ip dhcp bind
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
12.12.12.100        0063.6973.636f.2d63.    Oct 31 2011 03:21 PM    Automatic
                    3230.302e.3165.3633.
                    2e30.3030.302d.4661.
                    302f.30

R1で正しくIPアドレスが割り当てられたことが分かります。

R1(config-if)#
Oct 30 06:21:51.911: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 12.12.12.100, mask 255.255.255.0, hostname R1

R1(config-if)#do sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.100    YES DHCP   up                    up