IT技术互动交流平台

dynamips模拟三层交换网络环境

作者:network527  发布日期:2012-05-11 09:46:30


1,首先安装winpcpap 4.0再安装dynamips

2,进入dynamips目录,把下载的7200.bin放到images目录里面

3,配置或者下载itaa01.net这样的配置文件放到dynamips安装目录下

4,运行dynamips-start.cmd启动服务

5,再运行itaa01.net即可启动啦

启动后有二个窗口一个Dynagen控制台,一个Dynamips Server
Dynagen控制台命令列表:

list 列出所有的仿真路由器
start /all 启动一个仿真器
stop /all   停止一个仿真器


------------------------------      itaa01.net 配置文件 --------------------------------


autostart = true

[localhost]
     [[7200]]
     idlepc = 0x6066ce58
     #idlepc = 0x60968520
     image = \PROGRA~1\Dynamips\images\c7200.bin
     #image = \PROGRA~1\Dynamips\images\c7200-jk9o3s-nomz.124-8.bin
     # On Linux / Unix use forward slashes:
     # image = /opt/7200-images/c7200-jk9o3s-mz.124-7a.image
     npe = npe-400
     ram = 96
     nvram = 512
     confreg = 0x2142

     [[ROUTER R1]]
     console = 2001
     slot0 = PA-C7200-IO-FE
     slot1 = PA-4T
     F0/0 = NIO_gen_eth:\Device\NPF_{23B9C4E0-001E-4342-9B97-FE5A347B9CCB}
     s1/0 = R2 s1/0
     s1/1 = R3 s1/1
   

     [[ROUTER R2]]
     console = 2002
     slot1 = PA-4T
     F0/0 = S1 2
     s1/1 = R3 s1/0

     [[ROUTER R3]]
     console = 2003
     slot1 = PA-4T
     F0/0 = S1 3

     [[ethsw S1]]
     1 = dot1q 1
     2 = dot1q 1
     3 = dot1q 1

-----------------------------------------------------------------------------------------------


----------------------------------------------------------------------------------
常用FAQ:

1,让仿真器连接物理网络哦:

运行Network device list.cmd找到如下字样:

rpcap://\Device\NPF_{23B9C4E0-001E-4342-9B97-FE5A347B9CCB} : Network adapter
'Realtek RTL8139 Family Fast Ethernet Adapter' on local host

修改xxx.net文件把以太接口的参数改为物理网卡:
f0/0 = NIO_gen_eth:\Device\NPF_{23B9C4E0-001E-4342-9B97-FE5A347B9CCB}

测试:
config t
int f0/0
ip address 192.168.1.253 255.255.255.0
no shutdown
ping 192.168.1.1(通过)^_^

2,模拟三层交换机(加个NM-16ESW模块)


-----------------------------------------
三层交换机模拟试验:

# Simple lab

autostart = true

model = 3660
     [localhost]
  
     [[3660]]
     image = "\Program Files\Dynamips\images\c3660-is-mz.124-8.bin"
     exec_area = 8
     idlepc = 0x604b85e0
     ram = 128
     #slot5 = NM-16ESW

     [[ROUTER SW1]]
     slot1 = NM-16ESW
     fa1/0 = NIO_gen_eth:\Device\NPF_{23B9C4E0-001E-4342-9B97-FE5A347B9CCB}
     fa1/1 = NIO_gen_eth:\Device\NPF_{23B9C4E0-001E-4342-9B97-FE5A347B9CCB}

     fa1/2 = R1 fa0/0
     fa1/3 = R2 fa0/0
   
     [[router R1]]
     #model = 3640

     [[router R2]]
     #model = 3640
-------------------------------------------------------------

启动好后先测试:
SW1:
   int fa1/0
   no switchport                        (设成三层端口模式,不存取vlan,如果要存取vlan的话就必须是二层端口)
   ip add 192.168.1.253 255.255.255.0
   no shutdown
   ip route 0.0.0.0 0.0.0.0 192.168.1.104
   ping 192.168.1.1
   ping 外网ip都通

SW1:
int fa1/2
no switchport
ip address 172.16.1.1 255.255.255.0
no shutdown

R1:
int fa0/0
ip address 172.16.1.2 255.255.255.0
no shutdown

互ping是通的ok

清配置:
int fa1/2
no ip address

no ip route 0.0.0.0 0.0.0.0 192.168.1.104

------------------------------------------------------------------------
配置基于端口的vlan划分实验:

fa1/0   vlan11 192.168.1.253
fa1/2   vlan12 192.168.2.1
fa1/3   vlan13 192.168.3.1

代理服务器ip:192.168.1.104 (Linux Proxy)

---------------SW 1    --------------
hostname Center

vlan database                        #进入vlan数据配置模式
vlan 11                              #添加11,12,13vlan
vlan 12
vlan 13
show vlan-switch                     #查看是否添加成功

config t
int fa1/0
switchport
switchport access vlan 11
switchport mode access
int fa1/2
switchport access vlan 12
switchport mode access
int fa1/3
switchport access vlan 13
switchport mode access

show vlan-switch

config t                              #配置vlan的ip地址
int vlan 11
ip address 192.168.1.253 255.255.255.0
no shutdown

int vlan 12
ip address 192.168.2.1 255.255.255.0
no shutdown

int vlan 13
ip address 192.168.3.1 255.255.255.0
no shutdown

show ip int brief                    #查看配置ip是否正确
show ip route                        #产生的默认网络路由

ip routing                           #允许ip路由

ip route 0.0.0.0 0.0.0.0 192.168.1.104        #默认全部的通讯走192.168.1.104代理服务器出去

测试在:vlan 11上面的pc11测试,ping 192.168.1.253,192.168.2.1,192.168.3.1是否畅通
tracert -d 外网服务器,跟踪路由看看是否经过192.168.1.253,192.168.1.104

----------------   R1 ----------------------------
hostname PC12
show ip int brief
config t
int f0/0
ip address 192.168.2.2 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.2.1

测试:ping 192.168.2.1通,192.168.1.116通,192.168.1.253通

------------------ R2 ---------------------------------
hostname pc13

show ip int brief
config t
int f0/0
ip address 192.168.3.2 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.3.1

测试:ping 192.168.3.1通,192.168.1.116通,192.168.1.253通,192.168.2.2通

-------------    Linux Proxy 设置---------------------------------------------------

开启nat:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


配置到vlan间网络的路由:
ip route add 192.168.2.0/24 via 192.168.1.253
ip route add 192.168.3.0/24 via 192.168.1.253
或者:
route add -net 192.168.2.0 netmask 255.255.255.0 gateway 192.168.1.253
route -n看看应该有:
192.168.1.0
192.168.2.0
192.168.3.0的路由表了

ping 192.168.2.2
192.168.3.2
都通过
PC12,PC13测试192.168.1.104都过哈:)

PC12,PC13测试外网,通过^_^ GameOver

 

Tag标签: dynamips   三层交换网络  
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规