DHCP命令行操作

netsh管理DHCP Server
一般习惯于在Windows界面中配置DHCP Server,最近就利用netsh工具来对DHCP Server进行另类的配置,方法也是很简单
1、首先进入命令行dchp配置模式                             
F:\>netsh
netsh>dhcp
dhcp>server 192.168.0.1 //192.168.0.1是你需要管理的DHCP服务器的地址
2、dhcp server>show scope ;
显示作用域的个数
3、添加一个scope dhcp server>add scope 192.168.0.0 255.255.255.0 192.168.0.0 MyComment
4、dhcp server>scope 192.168.0.1
将当前作用域上下文改变到 192.168.0.1 作用域。                                
5、dhcp server scope>add iprange 192.168.0.2 192.168.0.254 DHCP
添加一个分配地址范围                                                                    
6、dhcp server scope>add excluderange 192.168.0.1 192.168.0.1
dhcp server scope>add excluderange 192.168.0.241 192.168.0.254
添加两个排除范围192.168.0.1,192.168.0.241-192.168.0.254
7、dhcp server scope>add reservedip 192.168.0.240 08002b30369B Mr.Wu Mr.wu both
添加一个保留ip,给了MAC 08002b30369B ,保留的名字称为Mr.Wu        
8、dhcp server scope>set optionvalue 003 ipaddress 192.168.0.1 8
dhcp server scope>set optionvalue 006 ipaddress 192.168.0.1
在这个scope中添加两个作用域选项003和006                                        
9、dhcp server scope>set reservedoptionvalue 192.168.0.240 003 ipaddress 192.168.0.1
设置保留地址192.168.0.240的作用域选项003                                 
现在scope 192.168.0.0配置结束了,你也可以配置别的选择的项目,看你的需要了
此时在mmc中把scope 192.168.0.0刷新一下,一切都正常了              
10、同样方法配置两个scope 192.168.1.0和192.168.2.0          
11、配置superscope                                                           
F:\>netsh
netsh>dhcp
dhcp>server 192.168.0.1
dhcp server>scopt 192.168.0.0
dhcp server scope>set superscope 192.168.0-192.168.2 1
F:\>netsh
  netsh>dhcp
dhcp>server 192.168.0.1
dhcp server>scopt 192.168.1.0 ;
dhcp server scope>set superscope 192.168.0-192.168.2 1
12、添加class                                                                    
dhcp server>add class workgroup1 workgroup1 ClassForWorkgroup1 0这样就添加了一个用户class                                                            
13、添加,配置多播作用域                                                              
dhcp server>add mscope 224.0.0.0 mscope 40
dhcp server>mscope 224.0.0.0 ( x& v) i- O9 w
dhcp server mscope>add iprange 224.0.0.1 224.0.0.10
dhcp server mscope>add excluderange 224.0.0.1 224.0.0.1

你可能感兴趣的:(windows,职场,休闲)