思科交換機DHCP配置:
拓撲圖
SW1配置:
Switch>enable -----從用戶模式進入特權(quán)模式
Switch#configure terminal-----從特權(quán)模式進入全局配置模式
Switch(config)#hostname sw1-----給交換機指定主機名為sw1
SW1(config)#vlan 10-----創(chuàng)建vlan 10
SW1(config)#vlan 20-----創(chuàng)建vlan 20
SW1(config)#interface fastEthernet 0/2-----進入接口配置模式
SW1(config-if)#switchport mode access-----配置vlan 訪問模式
SW1(config-if)#switchport access vlan 10-----設(shè)置端口可以訪問VLAN 10
SW1(config-if)#no shutdown-----啟用端口
SW1(config)#interface fastEthernet 0/3-----進入接口配置模式
SW1(config-if)#switchport mode access-----配置vlan 訪問模式
SW1(config-if)#switchport access vlan 20-----設(shè)置端口可以訪問VLAN 20
SW1(config-if)#no shutdown-----啟用端口
SW1(config)#interface fastEthernet 0/1-----進入接口配置模式
SW1(config-if)#switchport mode trunk-----配置vlan 訪問模式
SW1(config-if)#switchport trunk allowed vlan 10,20-----設(shè)置端口可以訪問VLAN 10,20
SW1(config-if)#no shutdown-----啟用端口
SW2配置:
Switch>enable -----從用戶模式進入特權(quán)模式
Switch#configure terminal-----從特權(quán)模式進入全局配置模式
Switch(config)#hostname sw2-----給交換機指定主機名為sw2
SW2(config)#vlan 30-----創(chuàng)建vlan 30
SW2(config)#vlan 40-----創(chuàng)建vlan 40
SW2(config)#interface fastEthernet 0/2-----進入接口配置模式
SW2(config-if)#switchport mode access-----配置vlan 訪問模式
SW2(config-if)#switchport access vlan 30-----設(shè)置端口可以訪問VLAN 30
SW2(config-if)#no shutdown-----啟用端口
SW2(config)#interface fastEthernet 0/3-----進入接口配置模式
SW2(config-if)#switchport mode access-----配置vlan 訪問模式
SW2(config-if)#switchport access vlan 40-----設(shè)置端口可以訪問VLAN 40
SW2(config-if)#no shutdown-----啟用端口
SW2(config)#interface fastEthernet 0/1-----進入接口配置模式
SW2(config-if)#switchport mode trunk-----配置vlan 訪問模式
SW2(config-if)#switchport trunk allowed vlan 30,40-----設(shè)置端口可以訪問VLAN 30,40
SW2(config-if)#no shutdown-----啟用端口
SW3配置:
Switch>enable -----從用戶模式進入特權(quán)模式
Switch#configure terminal-----從特權(quán)模式進入全局配置模式
Switch(config)#hostname sw3-----給交換機指定主機名為sw3
SW3(config)#interface fastEthernet 0/1-----進入接口配置模式
SW3(config-if)#switchport trunk allowed vlan 10,20-----設(shè)置端口可以訪問VLAN 10,20
SW3(config)#interface fastEthernet 0/2-----進入接口配置模式
SW3(config-if)#switchport trunk allowed vlan 30,40-----設(shè)置端口可以訪問VLAN 30,40
SW3(config)#interface? vlan 10-----進入vlan 10配置模式
SW3(config-if)#ip address 192.168.10.1 255.255.255.0-----配置IP地址和子網(wǎng)掩碼
SW3(config)#ip dhcp pool 10-----創(chuàng)建地址池
SW3(config-if)# network 192.168.10.0 255.255.255.0---可以下發(fā)的網(wǎng)段
SW3(dhcp-config)#default-router 192.168.10.1-----網(wǎng)關(guān)
SW3(dhcp-config)#dns-server 114.114.114.114-----dns服務(wù)器
SW3(config)#interface? vlan 20-----進入vlan 20配置模式
SW3(config-if)#ip address 192.168.20.1 255.255.255.0-----配置IP地址和子網(wǎng)掩碼
SW3(config)#ip dhcp pool20-----創(chuàng)建地址池
SW3(config-if)# network 192.168.20.0 255.255.255.0---可以下發(fā)的網(wǎng)段
SW3(dhcp-config)#default-router 192.168.20.1-----網(wǎng)關(guān)
SW3(dhcp-config)#dns-server 114.114.114.114-----dns服務(wù)器
SW3(config)#interface? vlan 30-----進入vlan 30配置模式
SW3(config-if)#ip address 192.168.30.1 255.255.255.0-----配置IP地址和子網(wǎng)掩碼
SW3(config)#ip dhcp pool 30-----創(chuàng)建地址池
SW3(config-if)# network 192.168.30.0 255.255.255.0---可以下發(fā)的網(wǎng)段
SW3(dhcp-config)#default-router 192.168.30.1-----網(wǎng)關(guān)
SW3(dhcp-config)#dns-server 114.114.114.114----dns服務(wù)器
SW3(config)#interface? vlan 40-----進入vlan 40配置模式
SW3(config-if)#ip address 192.168.40.1 255.255.255.0-----配置IP地址和子網(wǎng)掩碼
SW3(config)#ip dhcp pool 40-----創(chuàng)建地址池
SW3(config-if)# network 192.168.40.0 255.255.255.0---可以下發(fā)的網(wǎng)段
SW3(dhcp-config)#default-router 192.168.40.1-----網(wǎng)關(guān)
SW3(dhcp-config)#dns-server 114.114.114.114-----dns服務(wù)器
保留網(wǎng)關(guān)地址不下發(fā),排除地址。在全局模式下配置
SW3(config)#ip dhcp excluded-address 192.168.10.1
SW3(config)#ip dhcp excluded-address 192.168.20.1
SW3(config)#ip dhcp excluded-address 192.168.30.1,
SW3(config)#ip dhcp excluded-address 192.168.40.1
最后回到pc上,打開Desktop,選擇第一個(圖片上帶106的)。
文章來源:http://www.zghlxwxcb.cn/news/detail-476287.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-476287.html
到了這里,關(guān)于思科交換機DHCP配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!