VLAN间路由与NAT实验,包教包会
一、实验拓扑图.
二、基本配置
1)配置VLAN与命名VLANvlan 10name Connect.To.R1vlan 11name ITvlan 12name Salesvlan 13name HR
spanning-tree portfast default
spanning-tree vlan 1,10-13 root primary
interface FastEthernet0/1switchport access vlan 11switchport mode access
interface FastEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
interface FastEthernet0/4
switchport trunk encapsulation dot1q
switchport mode trunk
interface FastEthernet0/24
description ##Connect To R1##
switchport access vlan 10
switchport mode access
interface Vlan1 ip address 10.1.1.254 255.255.255.0interface Vlan10 ip address 10.1.10.254 255.255.255.0interface Vlan11 ip address 10.1.11.254 255.255.255.0interface Vlan12 ip address 10.1.12.254 255.255.255.0interface Vlan13ip address 10.1.13.254 255.255.255.0
ip route 0.0.0.0 0.0.0.0 10.1.10.253
vlan 11name ITvlan 12name Salesvlan 13name HRspanning-tree portfast defaultinterface FastEthernet0/1switchport access vlan 12switchport mode accessinterface FastEthernet0/2switchport mode trunkinterface FastEthernet0/12switchport mode trunkinterface vlan 1ip address 10.1.1.12 255.255.255.0no shutip default-gateway 10.1.1.254
vlan 11
name IT
vlan 12
name Sales
vlan 13
name HR
spanning-tree portfast default
interface FastEthernet0/1
switchport access vlan 13
switchport mode access
interface FastEthernet0/4
switchport mode trunk
interface FastEthernet0/12
switchport mode trunk
interface vlan 1
ip address 10.1.1.13 255.255.255.0
no shut
ip default-gateway 10.1.1.254
三、配置R1
interface FastEthernet0/0 description ##Connect To SW1## ip address 10.1.10.253 255.255.255.0 no shutinterface serial0/1/0 description ##Connect To Internet## ip address 12.1.1.1 255.255.255.0 no shutip route 10.1.0.0 255.255.0.0 10.1.10.254 //R1回内部VLAN的回程路由ip route 0.0.0.0 0.0.0.0 12.1.1.2 //到Internet的默认路由
access-list 100 permit ip 10.1.1.0 0.0.0.255 any
access-list 100 permit ip 10.1.10.0 0.0.0.255 any
access-list 100 permit ip 10.1.11.0 0.0.0.255 any
access-list 100 permit ip 10.1.12.0 0.0.0.255 any
access-list 100 permit ip 10.1.13.0 0.0.0.255 any
ip nat inside source list 100 interface serial0/1/0 overload
interface FastEthernet0/0
ip nat inside
interface serial0/1/0
ip nat outside
access-list 110 permit ip 10.1.1.0 0.0.0.255 anyaccess-list 110 permit ip 10.1.10.0 0.0.0.255 anyaccess-list 111 permit ip 10.1.11.0 0.0.0.255 anyaccess-list 112 permit ip 10.1.12.0 0.0.0.255 anyaccess-list 113 permit ip 10.1.13.0 0.0.0.255 any
ip nat pool vlan1and10pool 12.1.1.110 12.1.1.110 netmask 255.255.255.0
ip nat pool vlan11pool 12.1.1.111 12.1.1.111 netmask 255.255.255.0
ip nat pool vlan12pool 12.1.1.112 12.1.1.112 netmask 255.255.255.0
ip nat pool vlan13pool 12.1.1.113 12.1.1.113 netmask 255.255.255.0
3)配置ACL与地址池关联
ip nat inside source list 110 pool vlan1andpool overload
ip nat inside source list 111 pool vlan11pool overload
ip nat inside source list 112 pool vlan12pool overload
ip nat inside source list 113 pool vlan13pool overload
1)配置ACLaccess-list 100 permit ip 10.1.0.0 0.0.255.255 any2)配置地址池ip nat pool natpool 12.1.1.110 12.1.1.113 netmask 255.255.255.03)配置ACL和地址池关联ip nat inside source list 100 pool natpool overload
四、配置R2和PCA 作为Internet
interface serial0/0
ip address 12.1.1.2 255.255.255.0
no shut
interface e0/0
ip address 100.1.1.254 255.255.255.0
no shut
interface loopback0
ip address 2.2.2.2 255.255.255.255
[cisco@pca ~]$ ifconfig eth0 100.1.1.1 netmask 255.255.255.0 up[cisco@pca ~]$ route add default gw 100.1.1.254
五、测试
1、在PC1上Ping测试到PC2 PC3 VLAN间的通信
2、在PC1上Ping 测试到Internet 2.2.2.2通信
end
赞 (0)