Router1 E0/0 <----> Switch1 F0/0
Router2 E0/0 <----> Switch1 F0/10
实验要求:
router模拟PC(注意:关闭路由功能)
交换机必须是3层交换机
R1可以访问R2,R2不能访问R1,r2访问访问其他正常,可以互相PING。
 
 
配置:
R1
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

en
conf t
no ip routing(注意:关闭路由功能,不关闭路由功能,路由器首先找路由表)
hostname R1
int e0/0
ip add 192.168.10.2 255.255.255.0
no sh
exit
enable password cisco (设置特权模式密码)
line vty 0 4 (设置telnet登入)
password cisco(设置telnet登入密码)
login(激活)

 

 

 

 

R2

 

en
conf t
no ip routing(注意:关闭路由功能,不关闭路由功能,路由器首先找路由表)
host R2
int e0/0
ip add 192.168.20.2 255.255.255.0
no sh
enable password cisco(设置特权模式密码)
line vty 0 4 (设置telnet登入)
password cisco(设置telnet登入密码)
login(激活)

 

 

 

 

SW 3640

 

en
conf t
host SW3640
exit
vlan da (添加vlan
vlan10 name vlan10
vlan20 name vlan20
exit
conf t
int ra e0/0 -9  (将端口0-9加入到vlan10
sw mo access
sw access vlan 10
exit
int range e0/10 -15 (将端口10-15加入到vlan20
sw mode access
sw access vlan 20
exit
int vlan 10 vlan10设置IP
ip add 192.168.10.1 255.255.255.0
exit
int vlan 20 vlan10设置IP
ip add 192.168.20.1 255.255.255.0
exit
ip access-list extended vlan10 (设置访问控制列表名称)
permit icmp any any (允许ICMp协议)
permit ip 192.168.10.0 <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.255 192.168.20.0 0.0.0.255 reflect vlan-int(当10.0网段去访问 20.0网段的时候就给打个标
vlan10-infilter
permit ip any any(允许访问所有IP
exit

 

ip access-list extended vlan20(设置访问控制列表名称)
permit icmp any any(允许ICMp协议)
evaluate vlan10-int(如果是打了标记vlan10-infilter的就放行 否则匹配下一条)
deny ip any 192.168.10.0 0.0.0.255(拒绝所有IP10.0网段)
permit ip any any (允许访问所有IP
exit

 

int vlan10
ip grou vlan10 in(将策略vlan10应用到接口)
exit
int vlan20
ip grou    vlan20 in(将策略vlan20应用到接口)

 

验证:
R1#Pping 192.168.20.2 (R2IP地址)
!!!!!
R1#telnet 192.168.20.2 (R2IP地址) 正常是能登入访问的。

 

 

 

R1#Pping 192.168.10.2 (R1IP地址)
!!!!!
R1#Ptelnet 192.168.10.2 (R1IP地址) 正常是不法登入访问的。