前置
上一篇介绍了安装GNS3,并模拟了2个不同网段的通讯,本篇模拟下DHCP
配置
DHCPserver
R1#show int description
Interface Status Protocol Description
Fa0/0 up up
Fa0/1 admin down down
R1#en
R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip dhcp pool DHCPServer
R1(dhcp-config)#network 10.10.1.0 255.255.255.0
R1(dhcp-config)#default-router 10.10.1.1
R1(dhcp-config)#dns-server 114.114.114.114
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 10.10.1.1
R1(config)#end
R1#
*Aug 8 10:06:21.615: %SYS-5-CONFIG_I: Configured from console by console
R1#
*Aug 8 10:06:26.743: %DHCPD-4-PING_CONFLICT: DHCP address conflict: server pinged 10.10.1.2.
R1#
VPCS
PC1> dhcp # 启用dhcp
DDORA IP 10.10.1.3/24 GW 10.10.1.1 # 获取到IP信息,这里是10.10.1.3
PC1> show ip
NAME : PC1[1]
IP/MASK : 10.10.1.3/24
GATEWAY : 10.10.1.1
DNS : 114.114.114.114
DHCP SERVER : 10.10.1.1
DHCP LEASE : 86165, 86400/43200/75600
MAC : 00:50:79:66:68:00
LPORT : 20004
RHOST:PORT : 127.0.0.1:20005
MTU: : 1500
PC1>
# PC2 同理,其获取到的IP为10.10.1.4
测试
PC1> ping 10.10.1.4
84 bytes from 10.10.1.4 icmp_seq=1 ttl=64 time=0.128 ms
84 bytes from 10.10.1.4 icmp_seq=2 ttl=64 time=0.192 ms
^C
PC1>