dhcp配置命令
r1(config)#ip dhcp pool vlan100 //取地址池名
r1(dhcp-config)#network 192.168.1.0 /24 //下发ip地址段
r1(dhcp-config)#default-router 192.168.1.1 //下发默认网关
r1(dhcp-config)#dns-server 8.8.8.8 144.144.144.144 //下发dns
r1(dhcp-config)#lease 7 //设定地址租期
r1(config)#ip dhcp excluded-address 192.168.8.8 192.168.8.88 //保留ip地址
dhcp中继配置命令
m1(config-if)#ip helper-address 202.106.1.1 //指定dhcp中继ip地址
例:
sw1配置
!
interface FastEthernet1/1
switchport access vlan 10
!
interface FastEthernet1/2
switchport access vlan 20
!
interface FastEthernet1/15
switchport mode trunk
!
m1配置
!
interface FastEthernet1/0
no switchport
ip address 202.106.1.1 255.255.255.252
!
interface FastEthernet1/1
switchport mode trunk
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
ip helper-address 202.106.1.2
!
interface Vlan20
ip address 192.168.20.1 255.255.255.0
ip helper-address 202.106.1.2
!
r1配置
!
ip dhcp pool vlan10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8 144.144.144.144
!
ip dhcp pool vlan20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
dns-server 9.9.9.9 10.10.10.10
!
interface FastEthernet0/0
ip address 202.106.1.2 255.255.255.252
!
ip route 0.0.0.0 0.0.0.0 202.106.1.1
!