本文共 2386 字,大约阅读时间需要 7 分钟。
ip dhcp excluded 192.168.0.1 (排除的IP)ip dhcp pool xxx(随便你定义的名字)network 192.168.0.0 255.255.255.0 (你分配的IP段)default-router 192.168.0.1 (关网的网内)dns-server 202.96.64.68 (DNS服务器的IP)lease 7netbios-name-serverRouter>enPassword:Router#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#ip dhcp excluded 10.10.0.1 10.10.0.254Router(config)#ip dhcp pool officeRouter(dhcp-config)#network 10.10.0.0 255.255.255.0Router(dhcp-config)#default-router 10.10.0.254Router(dhcp-config)#dns-server 208.67.222.222 208.67.220.220Router(dhcp-config)#netbios-name-server 10.10.0.2Router(dhcp-config)#lease 7Router(dhcp-config)#endRouter#
可变长子网掩码实例
ip dhcp excluded-address 192.168.40.250 192.168.40.254ip dhcp excluded-address 192.168.50.250 192.168.50.254!ip dhcp pool Office-1 network 192.168.40.240 255.255.255.240 default-router 192.168.40.254 dns-server 208.67.222.222 208.67.220.220 lease 7!ip dhcp pool Office-2 network 192.168.50.128 255.255.255.128 default-router 192.168.50.254 dns-server 208.67.222.222 208.67.220.220 lease 7!interface GigabitEthernet0/1 description Office-1 ip address 192.168.40.254 255.255.255.240 ip nat inside ip virtual-reassembly in duplex auto speed auto!interface GigabitEthernet0/2 description Office-2 ip address 192.168.50.254 255.255.255.128 ip nat inside ip nat enable ip virtual-reassembly in duplex auto speed auto!2911(dhcp-config)#do show ip dhcp pool Office-2Pool Office-2 : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 126 Leased addresses : 0 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.50.129 192.168.50.129 - 192.168.50.254 02911(config)#do show ip dhcp pool Office-1Pool Office-1 : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 14 Leased addresses : 1 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.40.242 192.168.40.241 - 192.168.40.254 1
OpenDNS
dns-server 208.67.222.222dns-server 208.67.220.220
dns-server 8.8.8.8dns-server 4.4.4.4