0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DHCP_Snooping/IP Sourceguard

Last updated at Posted at 2023-06-03

FortigateをDHCPサーバーにして、PC端末を接続したときにサーバーからCatalystを通ってIPアドレスを取得出来る構成にします。

環境

  • Fortigate60D v6.0.7
  • Cisco WS-C3560CG-8PC-S 12.2(55)EX3
  • PC端末 windows11

イメージ図

fortigate@dhcpイメージ図.jpg

DHCP_Snooping

FortigateをDHCPサーバーに

Catalystとtrunkモードで通信したいので、internal1にVLANを紐付け。
なお、スイッチがaccessモードでもdhpcパケットを通信可能。その場合は、物理I/FにDHCPの設定をする。
fortigate@dhcp1.PNG

VLAN番号とI/FとなるIp/ネットワークマスクを入力。
DHCPサーバをチェックを入れて、接続した端末に付与するIPアドレスを入力。
fortigate@dhcp2.PNG

Catalyst設定

DHCPスヌーピングを有効化

(config)# ip dhcp snooping

DHCPスヌーピングを有効化するVLANを指定。

(config)# ip dhcp snooping vlan vlan-id 

正規のDHCPサーバからDHCPOFFERが送られるポートを以下の設定にする。それ以外のポートは、デフォルトではuntrastになる。その結果、不正なDHCPサーバが接続されたとしても、そのDHCPサーバから送信されるDHCPOFFERをブロックする。
※PCからDHCPサーバーへと送信されるDHCPDISCOVERやDHCPREQUESTは、信頼しないポートであってもブロックの対象とはならないため、PCと接続しているポートも信頼しないポートに設定。

(config)# interface interface gi0/9
(config-if) ip dhcp snooping trust

サーバーを繋ぐI/Fはtrunkモード、端末を繋ぐI/Fにはaccessモードで設定。

Switch123#show running-config
Building configuration...

ip dhcp snooping vlan 150
no ip dhcp snooping information option
ip dhcp snooping
!
interface GigabitEthernet0/8
 switchport access vlan 150
 switchport mode access
!
interface GigabitEthernet0/9
 switchport access vlan 150
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 150
 switchport mode trunk
 ip dhcp snooping trust
!
interface Vlan150
 ip address 192.168.0.2 255.255.255.0
!

gi0/9を信頼している条件で、Catalystに接続したPC端末がDHCPによってIPアドレス(192.168.0.5)を取得出来た時のパケットキャプチャ。
gi0/9を信頼しない条件で、再検証するとPCはIPアドレスを取得出来ず、期待した動作になった。
dhcpsnooping.png

showコマンドで確認

DHCPスヌーピングバインディングテーブルの表示

# show ip dhcp snooping binding
 MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface 
------------------  ---------------  ----------  -------------  ----  -------------------- 
68:45:F1:17:66:5B   192.168.0.5      604267      dhcp-snooping   150   GigabitEthernet0/8
Total number of binding: 1

DHCPスヌーピング設定情報表示

Switch123#show ip dhcp snooping
Switch DHCP snooping is enabled
DHCP snooping is configured on following VLANs:
150
DHCP snooping is operational on following VLANs:
150
DHCP snooping is configured on the following L3 Interfaces:

Insertion of option 82 is disabled
   circuit-id default format: vlan-mod-port
   remote-id: 34a8.4eda.1680 (MAC)
Option 82 on untrusted port is not allowed
Verification of hwaddr field is enabled
Verification of giaddr field is enabled
DHCP snooping trust/rate is configured on the following Interfaces:

Interface                  Trusted    Allow option    Rate limit (pps)
-----------------------    -------    ------------    ----------------   
GigabitEthernet0/9         yes        yes             unlimited
  Custom circuit-ids:

DHCPスヌーピング統計情報表示

Switch123#show ip dhcp snooping statistics
 Packets Forwarded                                     = 110
 Packets Dropped                                       = 0
 Packets Dropped From untrusted ports                  = 0

IP Sourceguard

上記の構成を利用してIP Sourceguardを検証します。
untrastのgi0/8にソースガードの設定

(config)#interface gi0/8 
(config-if-range)#ip verify source

gi0/8に接続した端末からの送信元IPアドレスがバインディングテーブルに掲載されていない場合は通信を破棄する。

show running-config
interface GigabitEthernet0/8
 switchport access vlan 150
 switchport mode access
 ip verify source
!
interface GigabitEthernet0/9
 switchport access vlan 150
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 150
 switchport mode trunk
 ip dhcp snooping trust
!
interface Vlan150 ip address 192.168.0.2 255.255.255.0

動的IPの設定がされたPCを接続して、IPソースバインディングテーブルの表示。

Switch123#show ip source binding
 MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface
 ------------------  ---------------  ----------  -------------  ----  --------------------
 68:45:F1:17:66:5B   192.168.0.10     604794      dhcp-snooping   150   GigabitEthernet0/8
 Total number of bindings: 1

IPソースガードの設定情報とバインディング情報を確認。

Switch123#show ip verify source
 Interface  Filter-type  Filter-mode  IP-address       Mac-address        Vlan
 ---------  -----------  -----------  ---------------  -----------------  ----
 Gi0/8      ip           active       192.168.0.10                        150

上の状態で接続をしたまま、動的IPから静的IP(192.168.0.10)に変更すると、同じセグメントであっても通信が破棄される。
(HTTP/HTTPSの通信は破棄されたが、ICMPは自分が行った検証では破棄されなかった。)

Switch123#show ip verify source
 Interface  Filter-type  Filter-mode  IP-address       Mac-address        Vlan
 ---------  -----------  -----------  ---------------  -----------------  ----
 Gi0/3      ip           inactive-no-snooping-vlan
 Gi0/8      ip           active       deny-all                            150
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?