在路由器中或者是交換機中,DHCP服務(wù)器的使用非常廣泛。那么這里我們就來講解一下這方面的知識吧。首先讓我們看看3750配置DHCP snooping的內(nèi)容吧。(無用的部分已經(jīng)刪除了)具體操作如下:
- clock timezone WST 8
- switch 1 provision ws-c3750g-48ts
- system mtu routing 1500
- ip subnet-zero
- ip dhcp excluded-address 192.168.1.1 (保留地址)
- !
- ip dhcp pool test (啟動DHCP)
- network 192.168.1.0 255.255.255.0
- default-router 192.168.1.1
- dns-server 192.168.1.1
- !
- ip dhcp snooping vlan 1 (指定DHCP snooping防護的vlan)
- ip dhcp snooping information option allow-untrusted
- ip dhcp snooping database flash:snooping (指定數(shù)據(jù)庫路徑)
- ip dhcp snooping (3750配置DHCP snooping中首先啟動DHCP snooping)
- !
- !
- interface GigabitEthernet1/0/1
- !
- interface GigabitEthernet1/0/31 (正常的端口)
- switchport mode access
- spanning-tree portfast
- !
- interface GigabitEthernet1/0/32
- !
- interface GigabitEthernet1/0/42
- !
- interface GigabitEthernet1/0/43 (啟用IP DHCP snooping端口)
- switchport mode access
- switchport port-security
- spanning-tree portfast
- ip verify source
(啟用IP地址效驗,此端口用戶不能自己設(shè)置地址,只能通過DHCP獲得,但沒有mac層安全控制。
3750配置DHCP snooping的測試發(fā)現(xiàn),假如g1/0/43口的用戶分得地址=192.168.1.2,g1/0/42用戶故意修改IP為192.168.1.2,也會影響 g1/0/43的用戶,雖然g1/0/42修改IP不能訪問網(wǎng)絡(luò),但g1/0/43會提示IP沖突,所以必須結(jié)合DAI才能保護mac層)
- !
- interface GigabitEthernet1/0/44
- !
- interface GigabitEthernet1/0/45
- switchport mode access
- switchport port-security
- switchport port-security violation restrict
- spanning-tree portfast
- ip verify source port-security
(啟用后此端口無法DHCP注冊地址,分析原因由于port-security的安全限制無法注冊MAC)
- (ip verify source port-security是配合啟動IP soure binding使用
- ip source binding 001b.a111.5e11 vlan 1 192.168.1.200 interface Gi1/0/45,注意ip source binding和動態(tài)DHCP不能同時用)
- !
- interface GigabitEthernet1/0/46
以上就是3750配置DHCP snooping的具體內(nèi)容了。
|