Cisco IOS IPサービス – DHCP proxy (IPCP)の設定

スポンサーリンク

IPCPによって、アドレスを割り当てる方法は、staticやローカルで定義したプールや他のDHCPサーバに問い合わせる方法があります。ここではDHCPを利用する方法についてまとめます。

DHCP proxy

設定方法

DHCPによって取得したIPアドレスをIPCPで対向に割り当てるには以下のように設定します。”ip address-pool dhcp-procy-client”コマンドでDHCPによるアドレス取得を有効にし、”ip dhcp-server”コマンドでDHCP serverのアドレスを指定します。

Router(config)# ip address-pool dhcp-procy-client
Router(config)# ip dhcp-server <addr>
Router(config)# interface <interface>
Router(config-if)# peer default ip address dhcp

構成概要

R2はDHCP proxy clientとして、R3はDHCP serverとして設定します。

       e0/0      e0/0    e0/1      e0/0 
 +------+dhcp    .2+------+.2      .3+------+
 |  R1  +----------+  R2  +----------+  R3 | 
 +------+          +------+          +------+
      192.168.12.0/24   192.168.23.0/24
 [R1]
interface Serial0/0
 ip address negotiated
 encapsulation ppp

 [R2]
ip address-pool dhcp-proxy-client
ip dhcp-server 192.168.23.3
!
interface Serial0/0
 ip address 192.168.12.2 255.255.255.0
 encapsulation ppp
 peer default ip address dhcp
!
interface Ethernet1/0
 ip address 192.168.23.2 255.255.255.0

 [R3]
ip dhcp excluded-address 192.168.12.2
!
ip dhcp pool VLAN12
   network 192.168.12.0 255.255.255.0
!
interface Ethernet0/0
 ip address 192.168.23.3 255.255.255.0
!
ip route 192.168.12.2 255.255.255.255 192.168.23.2

動作確認

想定通りのIPアドレスが割り当てられている事を確認します。

R1#show ip interface Serial 0/0
Serial0/0 is up, line protocol is up
  Internet address is 192.168.12.3/32
  Broadcast address is 255.255.255.255
  Address determined by IPCP
  Peer address is 192.168.12.2

 <omitted>

なお、この時、R2 e1/0で観測されたパケットは以下の通りです。DHCP relay agentと同様に、R2が転送するDHCP Discover messageの送信元が192.168.12.2になっている事に注意して下さい。つまり、R3は192.168.12.2へのルーティング定義が必要である事に注意して下さい。

No.     Time        Source                Destination           Protocol Info
     17 9.344000    192.168.12.2          192.168.23.3          DHCP     DHCP Discover - Transaction ID 0x9ca
     18 11.375000   192.168.23.3          192.168.12.2          DHCP     DHCP Offer    - Transaction ID 0x9ca
     19 11.875000   192.168.12.2          192.168.23.3          DHCP     DHCP Discover - Transaction ID 0x9cb
     20 11.906000   192.168.23.3          192.168.12.2          DHCP     DHCP Offer    - Transaction ID 0x9cb
     21 11.937000   192.168.12.2          192.168.23.3          DHCP     DHCP Request  - Transaction ID 0x9cb
     22 11.953000   192.168.23.3          192.168.12.2          DHCP     DHCP ACK      - Transaction ID 0x9cb
     23 12.094000   cc:01:09:a0:00:10     Broadcast             ARP      Gratuitous ARP for 192.168.12.1 (Reply)
タイトルとURLをコピーしました