CiscoルータにてDHCPサーバの設定を行います。
DHCPクライアントはPCがよかったのですが、面倒だったので今回はクライアントもルータです。
今回の構成図
R2,R4,R5はVLAN10(192.168.10.0/24)に所属しています。
上図R2をDHCPサーバに、R5とR4がDHCPクライアントとして設定します。
R1はスイッチモジュールを追加しスイッチとして扱っています。
DHCPサーバの設定手順
以下R4へ設定をしていきます。
service dhcp ip dhcp pool test1 network 192.168.10.0 255.255.255.0 default-router 192.168.10.1 lease 2
ip dhcp pool test1
アドレスプールを作成します。
network 192.168.10.0 255.255.255.0
192.168.10.0-255を貸し出します。
default-router 192.168.10.1
192.168.10.1をデフォルトゲートウェイとして通知します。
lease 2
貸出期間を2日にします。(デフォルトは1日)
R4とR5へはインターフェースへ以下を設定します。
R4
R4(config)#int fa 0/0 R4(config-if)#ip address dhcp
R5
R5(config)#int fa 0/0 R5(config-if)#ip address dhcp
DHCP設定がうまく行っているか確認
IPアドレス払い出し状況を確認します。
R2#show ip dhcp binding Bindings from all pools not associated with VRF: IP address Client-ID/ Lease expiration Type Hardware address/ User name 192.168.10.2 0063.6973.636f.2d63. Mar 03 2002 12:03 AM Automatic 3030.612e.3136.6238. 2e30.3030.302d.4661. 302f.30 192.168.10.3 0063.6973.636f.2d63. Mar 03 2002 12:07 AM Automatic 3030.392e.3136.6238. 2e30.3030.302d.4661. 302f.30 R2#
誰にどのIPが割り当てられているかがわかります。
192.168.10.1は既にR2のSVIのIPとして使っているため、192.168.10.2からリースしています。
debug dhcp server events
DHCPディスカバーの受信等イベントを表示する。
show ip int bri 実行結果
R4#show ip int bri Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.10.3 YES DHCP up up FastEthernet0/1 unassigned YES unset administratively down down R4#