登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

The lazy man

Get busy living, or get busy dying.

 
 
 

日志

 
 

GNS3 单臂路由+DHCP  

2013-03-27 19:06:14|  分类: GNS3 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
在GNS3中使用C3660加上三层路由来实现单臂路由和DHCP的功能,进入正题。
网络拓扑图如图1所示,R1是路由器,R3是三层交换机:
GNS3 单臂路由+DHCP - ICQwlj - ICQwlj
图1 网络拓扑图
  首先,对R1进行单臂路由的配置:

R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#in fa0/0
R1(config-if)#no ip add
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#

R1(config)#int fa0/0.1
R1(config-subif)#encap dot1q 10
R1(config-subif)#ip add 192.168.10.1 255.255.255.0
R1(config-subif)#no shut
R1(config-subif)#int fa0/0.2
R1(config-subif)#encap dot1q 20
R1(config-subif)#ip add 192.168.20.1 255.255.255.0
R1(config-subif)#no shu
R1(config-subif)#no shut
R1(config-subif)#exit
R1(config)#exit

配置成功的显示:

R1#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES manual up up
FastEthernet0/0.1 192.168.10.1 YES manual up up
FastEthernet0/0.2 192.168.20.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down

然后,对R1进行DHCP配置:

R1(config)#ip dhcp pool vlan10
R1(dhcp-config)#network 192.168.10.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.10.1
R1(dhcp-config)#dns-server 192.168.10.1
R1(dhcp-config)#domain-name test1.com
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
R1(config)#ip dhcp pool vlan20
R1(dhcp-config)#network 192.168.20.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.20.1
R1(dhcp-config)#dns-server 192.168.20.1
R1(dhcp-config)#domain-name test2.com
R1(dhcp-config)#exit
R1(config)#exit
R1#

配置成功后,可以使用show ip dhcp pool指令来查询配置:

R1#show ip dhcp pool

Pool vlan10 :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 0
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.10.1 192.168.10.1 - 192.168.10.254 0

Pool vlan20 :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 0
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.20.1 192.168.20.1 - 192.168.20.254 0

接着,对R3进行配置,划分出两个VLAN——VLAN 10和VLAN 20,分别对应上面的fa0/0.1和fa0/0.2,配置如下:
a.先对fa1/0端口进行设置,将其设置成trunk模式:

R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int fa1/0
R3(config-if)#switchport mode trunk
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#exit
R3#

b.建立两个VLAN:

R3(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
R3(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
R3(vlan)#exit

c.将C1、C2分别划入到不同的VLAN中:

R3(config)#int fa1/1
R3(config-if)#shutdown
R3(config-if)#switchport mode access
R3(config-if)#no shut
R3(config-if)#switchport access vlan 10
R3(config-if)#exit

R3(config)#int fa1/2
R3(config-if)#shutdown
R3(config-if)#switchport mode access
R3(config-if)#no shut
R3(config-if)#switchport access vlan 20
R3(config-if)#exit

最后,在VPCS中,分别测试,结果如图,IP成功自动分配:

GNS3 单臂路由+DHCP - ICQwlj - ICQwlj
图2 IP自动分配
两台PC之间也能相互ping通,如图3所示:
GNS3 单臂路由+DHCP - ICQwlj - ICQwlj
 图3 PC间相互ping通
PS:在三层交换机中,有时候端口是处于开启状态的,但是协议却是关闭着的,这时候,DHCP是不能成功分配IP给PC的(其他配置正确);需要先将整个端口关闭,然后再重新打开,这时,会显示端口和协议都处于开启状态。

 
  评论这张
 
阅读(591)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018