DHCP(案例部分)

22 篇文章 0 订阅
22 篇文章 0 订阅

目录

一.案例一

1.1拓扑图

1.2案例配置

二.案例二

2.1拓扑图

2.2案例配置 


1.1拓扑图

1.2案例配置

LSW1
<Huawei>undo terminal monitor                                                                   关闭弹窗   
<Huawei>sy                                                                                                     用户视图 
[Huawei]sysname LSW1                                                                                   更改设备名为LSW1                                                                              
[LSW1]user-interface console 0                                                                       
[LSW1-ui-console0]id 0 0                                                                                    永不超时  
[LSW1-ui-console0]q                                                                                          退回到一级
[LSW1]vlan batch 10 20                                                                                      创建vlan10、20  
[LSW1]int g0/0/1                                                                                             进入g0/0/1端口     
[LSW1-GigabitEthernet0/0/1]port link-type trunk                                          选择trunk模式  
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all                     允许所有标签流量通告       
[LSW1-GigabitEthernet0/0/1]int g0/0/2                                                           进入g0/0/2端口                             
[LSW1-GigabitEthernet0/0/2]port link-type trunk                                            选择trunk模式
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all                          允许所有标签流量通告             
[LSW1-GigabitEthernet0/0/2]q                                                                          退回到上一级                                                                            
[LSW1]dhcp enable                                                                                           开启dhcp
[LSW1]ip pool dhcp1                                                                                         新建地址池一,地址池名称为dhcp1
[LSW1-ip-pool-dhcp1]network 192.168.10.0 mask 24                                      下发地址网段为192.168.10.0/24
[LSW1-ip-pool-dhcp1]gateway-list 192.168.10.1                                                下发网关地址为192.168.10.1
[LSW1-ip-pool-dhcp1]dns-list 8.8.8.8 114.114.114.114                                      下发dns地址有两个,主dns服务器地址是8.8.8.8, 备选服务器地址是114.114.114.114
[LSW1-ip-pool-dhcp1]lease 7                                                                                 租期为7天
[LSW1-ip-pool-dhcp1]excluded-ip-address 192.168.10.244 192.168.10.254         排除192.168.10.245~192.168.10.254
[LSW1-ip-pool-dhcp1]static-bind ip-address 192.168.10.120 mac-address 5489-9829-   静态绑定ip地址
122f
[LSW1-ip-pool-dhcp1]int vlan 10                                                                             进入 vlan10
[LSW1-Vlanif10]ip add 192.168.10.1   24                                                                  设置虚拟网关192.168.10.1/24
[LSW1-Vlanif10]dhcp select global                                                                            选择地址池方式分配ip地址
[LSW1-Vlanif10]q                                                                                                         退回到上一级
[LSW1]ip pool dhcp2                                                                                                  开启dhcp  
[LSW1-ip-pool-dhcp2]network 192.168.20.0 mask 24                                                下发地址网段为192.168.20.0/24
[LSW1-ip-pool-dhcp2]gateway-list 192.168.20.1                                                         下发网关地址为192.168.20.1
[LSW1-ip-pool-dhcp2]dns-list 8.8.8.8 114.114.114.114                                               下发dns地址有两个,主dns服务器地址是8.8.8.8, 备选服务器地址是114.114.114.114
[LSW1-ip-pool-dhcp2]lease 7                                                                                             租期为7天
[LSW1-ip-pool-dhcp2]static-bind ip-address 192.168.20.120 mac-address 5489-9869-      静态绑定ip地址
03aa
[LSW1-ip-pool-dhcp2]int vlan 20                                                                                         进入 vlan20                                                                                         
[LSW1-Vlanif20]ip add 192.168.20.1 24                                                                               设置虚拟网关192.168.20.1/24                                                                       
[LSW1-Vlanif20]dhcp select global                                                                                        选择地址池方式分配ip地址

sw2
<Huawei>undo terminal monitor                                                  关闭弹窗                                               
<Huawei>sys                                                                                  用户视图
[Huawei]sysname LSW2                                                                 更改设备名为LSW2  
[SW2]user-interface console 0                                                          永不超时        
[SW2-ui-console0]id 0 0                                                                  
[SW2-ui-console0]q                                                                       退回上一级
[SW2]vlan batch 10 20                                                                   创建vlan10、20  
[SW2]int e0/0/1                                                                           进入e0/0/1端口    
[SW2-Ethernet0/0/1]port link-type access                                   选择access模式
[SW2-Ethernet0/0/1]port default vlan 10                                       划给vlan10  
[SW2-Ethernet0/0/1]int e0/0/2                                                      进入e0/0/2端口                                                                                     
[SW2-Ethernet0/0/2]port link-type access                                   选择access模式
[SW2-Ethernet0/0/2]port default vlan 20                                       划给vlan20   
[SW2-Ethernet0/0/2]int g0/0/1                                                     进入g0/0/1端口
[SW2-GigabitEthernet0/0/1]port link-type trunk                            选择trunk模式  
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all              允许所有标签流量通告

sw3
<Huawei>undo terminal monitor                                                  关闭弹窗                                               
<Huawei>sys                                                                                  用户视图
[Huawei]sysname SW3                                                                 更改设备名为SW3  
[SW3]user-interface console 0                                                          永不超时        
[SW3-ui-console0]id 0 0                                                                  
[SW3-ui-console0]q                                                                       退回上一级
[SW3]vlan batch 10 20                                                                   创建vlan10、20  
[SW3]int e0/0/1                                                                           进入e0/0/1端口    
[SW3-Ethernet0/0/1]port link-type access                                   选择access模式
[SW3-Ethernet0/0/1]port default vlan 10                                       划给vlan10  
[SW3-Ethernet0/0/1]int e0/0/2                                                      进入e0/0/2端口                                                                                     
[SW3-Ethernet0/0/2]port link-type access                                   选择access模式
[SW3-Ethernet0/0/2]port default vlan 20                                       划给vlan20   
[SW3-Ethernet0/0/2]int g0/0/1                                                     进入g0/0/1端口
[SW3-GigabitEthernet0/0/1]port link-type trunk                            选择trunk模式  
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all              允许所有标签流量通告

二.案例二

2.1拓扑图

2.2案例配置 

LSW1
<Huawei>undo terminal monitor                                                                   关闭弹窗   
<Huawei>sy                                                                                                     用户视图 
[Huawei]sysname LSW1                                                                                   更改设备名为LSW1                                                                              
[LSW1]user-interface console 0                                                                       
[LSW1-ui-console0]id 0 0                                                                                    永不超时  
[LSW1-ui-console0]q                                                                                          退回到一级
[LSW1]vlan batch 10 20                                                                                      创建vlan10、20  
[LSW1]int g0/0/1                                                                                             进入g0/0/1端口     
[LSW1-GigabitEthernet0/0/1]port link-type trunk                                          选择trunk模式  
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all                     允许所有标签流量通告       
[LSW1-GigabitEthernet0/0/1]int g0/0/2                                                           进入g0/0/2端口                             
[LSW1-GigabitEthernet0/0/2]port link-type trunk                                            选择trunk模式
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all                          允许所有标签流量通告             
[LSW1-GigabitEthernet0/0/2]q                                                                          退回到上一级                                                                            
[LSW1]dhcp enable                                                                                           开启dhcp
[LSW1]ip pool dhcp1                                                                                         新建地址池一,地址池名称为dhcp1
[LSW1-ip-pool-dhcp1]network 192.168.10.0 mask 24                                      下发地址网段为192.168.10.0/24
[LSW1-ip-pool-dhcp1]gateway-list 192.168.10.1                                                下发网关地址为192.168.10.1
[LSW1-ip-pool-dhcp1]dns-list 8.8.8.8 114.114.114.114                                      下发dns地址有两个,主dns服务器地址是8.8.8.8, 备选服务器地址是114.114.114.114
[LSW1-ip-pool-dhcp1]lease 7                                                                                 租期为7天
[LSW1-ip-pool-dhcp1]excluded-ip-address 192.168.10.244 192.168.10.254         排除192.168.10.245~192.168.10.254
[LSW1-ip-pool-dhcp1]static-bind ip-address 192.168.10.120 mac-address 5489-9829-   静态绑定ip地址
122f
[LSW1-ip-pool-dhcp1]int vlan 10                                                                             进入 vlan10
[LSW1-Vlanif10]ip add 192.168.10.1   24                                                                  设置虚拟网关192.168.10.1/24
[LSW1-Vlanif10]dhcp select global                                                                            选择地址池方式分配ip地址
[LSW1-Vlanif10]q                                                                                                         退回到上一级
[LSW1]ip pool dhcp2                                                                                                  开启dhcp  
[LSW1-ip-pool-dhcp2]network 192.168.20.0 mask 24                                                下发地址网段为192.168.20.0/24
[LSW1-ip-pool-dhcp2]gateway-list 192.168.20.1                                                         下发网关地址为192.168.20.1
[LSW1-ip-pool-dhcp2]dns-list 8.8.8.8 114.114.114.114                                               下发dns地址有两个,主dns服务器地址是8.8.8.8, 备选服务器地址是114.114.114.114
[LSW1-ip-pool-dhcp2]lease 7                                                                                             租期为7天
[LSW1-ip-pool-dhcp2]static-bind ip-address 192.168.20.120 mac-address 5489-9869-      静态绑定ip地址
03aa
[LSW1-ip-pool-dhcp2]int vlan 20                                                                                         进入 vlan20                                                                                         
[LSW1-Vlanif20]ip add 192.168.20.1 24                                                                               设置虚拟网关192.168.20.1/24                                                                       
[LSW1-Vlanif20]dhcp select global                                                                                        选择地址池方式分配ip地址

sw2
<Huawei>undo terminal monitor                                                  关闭弹窗                                               
<Huawei>sys                                                                                  用户视图
[Huawei]sysname LSW2                                                                 更改设备名为LSW2  
[SW2]user-interface console 0                                                          永不超时        
[SW2-ui-console0]id 0 0                                                                  
[SW2-ui-console0]q                                                                       退回上一级
[SW2]vlan batch 10 20                                                                   创建vlan10、20  
[SW2]int e0/0/1                                                                           进入e0/0/1端口    
[SW2-Ethernet0/0/1]port link-type access                                   选择access模式
[SW2-Ethernet0/0/1]port default vlan 10                                       划给vlan10  
[SW2-Ethernet0/0/1]int e0/0/2                                                      进入e0/0/2端口                                                                                     
[SW2-Ethernet0/0/2]port link-type access                                   选择access模式
[SW2-Ethernet0/0/2]port default vlan 20                                       划给vlan20   
[SW2-Ethernet0/0/2]int g0/0/1                                                     进入g0/0/1端口
[SW2-GigabitEthernet0/0/1]port link-type trunk                            选择trunk模式  
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all              允许所有标签流量通告

sw3
<Huawei>undo terminal monitor                                                  关闭弹窗                                               
<Huawei>sys                                                                                  用户视图
[Huawei]sysname SW3                                                                 更改设备名为SW3  
[SW3]user-interface console 0                                                          永不超时        
[SW3-ui-console0]id 0 0                                                                  
[SW3-ui-console0]q                                                                       退回上一级
[SW3]vlan batch 10 20                                                                   创建vlan10、20  
[SW3]int e0/0/1                                                                           进入e0/0/1端口    
[SW3-Ethernet0/0/1]port link-type access                                   选择access模式
[SW3-Ethernet0/0/1]port default vlan 10                                       划给vlan10  
[SW3-Ethernet0/0/1]int e0/0/2                                                      进入e0/0/2端口                                                                                     
[SW3-Ethernet0/0/2]port link-type access                                   选择access模式
[SW3-Ethernet0/0/2]port default vlan 20                                       划给vlan20   
[SW3-Ethernet0/0/2]int g0/0/1                                                     进入g0/0/1端口
[SW3-GigabitEthernet0/0/1]port link-type trunk                            选择trunk模式  
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all              允许所有标签流量通告

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值