划分VLAN,根据每个VLAN通过DHCP分配IP地址
生活随笔
收集整理的這篇文章主要介紹了
划分VLAN,根据每个VLAN通过DHCP分配IP地址
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、新建立VLAN2并配置
switch>en?//進入特權模式 switch#con?//進入全局配置模式 switch(Config)#l3-forward enable ?//開啟三層轉發協議 switch(Config)#vlan 2?//建立VLAN2 switch(Config-Vlan2)#switchport interface ethernet 0/0/2-20?//給VLAN2分配端口 Set the port Ethernet0/0/2 access vlan 2 successfully Set the port Ethernet0/0/3 access vlan 2 successfully Set the port Ethernet0/0/4 access vlan 2 successfully Set the port Ethernet0/0/5 access vlan 2 successfully Set the port Ethernet0/0/6 access vlan 2 successfully Set the port Ethernet0/0/7 access vlan 2 successfully Set the port Ethernet0/0/8 access vlan 2 successfully Set the port Ethernet0/0/9 access vlan 2 successfully Set the port Ethernet0/0/10 access vlan 2 successfully Set the port Ethernet0/0/11 access vlan 2 successfully Set the port Ethernet0/0/12 access vlan 2 successfully Set the port Ethernet0/0/13 access vlan 2 successfully Set the port Ethernet0/0/14 access vlan 2 successfully Set the port Ethernet0/0/15 access vlan 2 successfully Set the port Ethernet0/0/16 access vlan 2 successfully Set the port Ethernet0/0/17 access vlan 2 successfully Set the port Ethernet0/0/18 access vlan 2 successfully Set the port Ethernet0/0/19 access vlan 2 successfully Set the port Ethernet0/0/20 access vlan 2 successfully switch(Config-Vlan2)#interface vlan 2?//進入虛擬三層管理端口 %Jan 01 00:11:50 2001 %LINK-5-CHANGED: Interface Vlan2, changed state to UP switch(Config-If-Vlan2)#ip address 192.168.2.1 255.255.255.0?//給VLAN2分配管理地址 switch(Config-If-Vlan2)# ~~~~~~~~~~~~~~~~~~~~~~~~vlan2配置完畢~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 二、建立VLAN3并配置 switch(Config)#vlan 3?//建立VLAN3 switch(Config-Vlan3)#switchport interface ethernet 0/0/21-52?//給VLAN3分配端口 Set the port Ethernet0/0/21 access vlan 3 successfully Set the port Ethernet0/0/22 access vlan 3 successfully Set the port Ethernet0/0/23 access vlan 3 successfully Set the port Ethernet0/0/24 access vlan 3 successfully Set the port Ethernet0/0/25 access vlan 3 successfully Set the port Ethernet0/0/26 access vlan 3 successfully Set the port Ethernet0/0/27 access vlan 3 successfully Set the port Ethernet0/0/28 access vlan 3 successfully Set the port Ethernet0/0/29 access vlan 3 successfully Set the port Ethernet0/0/30 access vlan 3 successfully Set the port Ethernet0/0/31 access vlan 3 successfully Set the port Ethernet0/0/32 access vlan 3 successfully Set the port Ethernet0/0/33 access vlan 3 successfully Set the port Ethernet0/0/34 access vlan 3 successfully Set the port Ethernet0/0/35 access vlan 3 successfully Set the port Ethernet0/0/36 access vlan 3 successfully Set the port Ethernet0/0/37 access vlan 3 successfully Set the port Ethernet0/0/38 access vlan 3 successfully Set the port Ethernet0/0/39 access vlan 3 successfully Set the port Ethernet0/0/40 access vlan 3 successfully Set the port Ethernet0/0/41 access vlan 3 successfully Set the port Ethernet0/0/42 access vlan 3 successfully Set the port Ethernet0/0/43 access vlan 3 successfully Set the port Ethernet0/0/44 access vlan 3 successfully Set the port Ethernet0/0/45 access vlan 3 successfully Set the port Ethernet0/0/46 access vlan 3 successfully Set the port Ethernet0/0/47 access vlan 3 successfully Set the port Ethernet0/0/48 access vlan 3 successfully Set the port Ethernet0/0/49 access vlan 3 successfully Set the port Ethernet0/0/50 access vlan 3 successfully Set the port Ethernet0/0/51 access vlan 3 successfully Set the port Ethernet0/0/52 access vlan 3 successfully switch(Config-Vlan3)#interface vlan 3?//進入虛擬三層管理端口 %Jan 01 00:09:14 2001 %LINK-5-CHANGED: Interface Vlan3, changed state to UP switch(Config-If-Vlan3)#ip address 192.168.3.1 255.255.255.0?//給VLAN3分配管理地址 switch(Config-If-Vlan3)# ~~~~~~~~~~~~~~~~~~~~~~~~vlan3配置完畢~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 三、開啟DHCP服務,并配置其為VLAN2分配IP地址 switch(Config)#service dhcp ?//全局配置模式下開啟DCHP服務 switch(Config)#ip dhcp pool vlan2dhcp?//建立DHCP分配地址池名稱 switch(dhcp-vlan2dhcp-config)#network-address 192.168.2.0 255.255.255.0?//給新建立的地址池分配IP地址段 switch(dhcp-vlan2dhcp-config)#default-router 192.168.2.1?//給新建立的地址池分配網關 switch(dhcp-vlan2dhcp-config)#dns-server 202.96.209.133 202.96.209.5?//給新建立的地址池分配DNS服務器 switch(dhcp-vlan2dhcp-config)#lease 3?//設置地址租期為三天 switch(dhcp-vlan2dhcp-config)#exit?//退出 switch(Config)#ip dhcp excluded-address 192.168.2.1 192.168.2.5?//設置排除的地址段 switch(Config)#exit?//退出 switch#write?//保存 四、給VLAN3分配IP地址 switch(Config)#ip dhcp pool vlan3dhcp?//建立DHCP分配地址池名稱 switch(dhcp-vlan3dhcp-config)#network-address 192.168.3.0 255.255.255.0?//給新建立的地址池分配IP地址段 switch(dhcp-vlan3dhcp-config)#default-router 192.168.3.1?//給新建立的地址池分配網關 switch(dhcp-vlan3dhcp-config)#dns-server 210.22.70.3 210.22.84.3?//給新建立的地址池分配DNS服務器 switch(dhcp-vlan3dhcp-config)#lease 3?//設置地址租期為三天 switch(dhcp-vlan3dhcp-config)#exit?//退出 switch(Config)#ip dhcp excluded-address 192.168.3.1 192.168.3.5?//設置排除的地址段 switch(Config)#exit?//退出 switch#write?//保存 至此,全部配置完畢,當終端接到相應的VLAN端口時即可通過DCHP分配相應的IP地址 二、配置DHCP服務器 現在我們只需要在網絡上找一臺計算機,安裝Windows 2000/2003 Server系統來充當DHCP服務器。做好準備工作之后,就可以來配置DHCP服務器了。 從控制面板的管理工具中打開DHCP項,在打開的窗口中單擊“操作”菜單下的“新建作用域”命令,在打開的操作向導窗口中輸入作用域的名稱,單擊“下一步”填寫IP地址范圍,分別設置起始IP地址、終止IP地址、子網掩碼等信息(圖1),繼續單擊“下一步”添加排除的IP地址范圍,在這里添加的IP客戶端將無法獲取,主要用于服務器、路由器、防火墻等使用,隨后會提示配置租約期限,默認值為8天,如果參與分配的IP地址比較少,那么該值可以設的小一些,即讓IP地址交換的頻率高一些,避免IP被長時間占用;當然現在內網IP地址一般都比較豐富,那么時間設置的長一些也沒有關系。? 圖1 接下來進入DHCP選項配置窗口,即是否設置客戶端的網關和DNS信息,選中“是,我現在想配置這些選項”(圖2),然后單擊“下一步”按鈕進入“路由器(默認網關)”窗口,在“IP地址”欄中輸入網關的地址,單擊“添加”按鈕加入,再單擊“下一步”設置DNS名稱,同樣在“IP地址”處填入DNS服務器的IP地址并單擊“添加”按鈕即可,下面還會詢問配置WINS服務器,一般不需要改動,直接單擊“下一步”激活新建的作用域即可。 圖2 重復上面的操作步驟,就可以為其它的VLAN在DHCP中創建出對應的作用域,這樣就可以全部配置完成,以后就可以讓DHCP與VLAN和諧相處,能夠實現在多VLAN中實現DHCP服務,從此讓網絡能夠更快速、更高效運行了。
轉載于:https://blog.51cto.com/563196908/857647
總結
以上是生活随笔為你收集整理的划分VLAN,根据每个VLAN通过DHCP分配IP地址的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Cisco路由器安全配置命令
- 下一篇: C#,JAVA各版本之Thread.jo