Ciso三层交换 上vlan间互通, 端口映射到vlan

 

 

 

路由器2911配置:

 

!
hostname router

interface GigabitEthernet0/0
ip address 10.0.0.2 255.0.0.0
ip nat outside
duplex auto
speed auto
!
interface GigabitEthernet0/1
ip address 192.168.40.1 255.255.255.0
ip nat inside
duplex auto
speed auto

interface Vlan1
no ip address
shutdown

ip nat inside source list 1 interface GigabitEthernet0/0 overload  

ip nat inside source static tcp 192.168.30.3 23 10.0.0.2 23    /*这条映射内网192.168.30.3 的23端口*/

ip classless

ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0    /*这条路由通往外网的*/
ip route 192.0.0.0 255.0.0.0 192.168.40.2     /*这条路由通往三层交换的*/
!
!
access-list 1 permit 192.168.0.0 0.0.255.255

end

 

 三层交换机3560:

 

hostname layer03

ip dhcp excluded-address 192.168.20.1
ip dhcp excluded-address 192.168.30.1
!
ip dhcp pool vlan2
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
ip dhcp pool vlan3
network 192.168.30.0 255.255.255.0
default-router 192.168.30.1
ip routing


interface FastEthernet0/1
switchport access vlan 4
switchport mode access

interface FastEthernet0/23
switchport access vlan 2
switchport mode access

interface FastEthernet0/24
switchport access vlan 3
switchport mode access

interface Vlan2
ip address 192.168.20.1 255.255.255.0
interface Vlan3
ip address 192.168.30.1 255.255.255.0
interface Vlan4
ip address 192.168.40.2 255.255.255.0

ip classless
ip route 0.0.0.0 0.0.0.0 192.168.40.1                    /*这条路由通往2911路由器的*/
ip route 192.168.0.0 255.255.0.0 192.168.30.3   /*这条路由通往客户端的*/

end

客户端2911配置:

 


client(config)#do sh run

!
hostname client

!
license udi pid CISCO2911/K9 sn FTX1524X1KS

!
interface GigabitEthernet0/0
ip address 192.168.30.3 255.255.255.0
duplex auto
speed auto

ip classless
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0   /*这条路由通往三层交换的*/
!
line con 0
!
line aux 0
!
line vty 0 4
password cisco
login
!
!
!
end

 

posted on 2019-10-25 10:57  alonso-zhou  阅读(950)  评论(0编辑  收藏  举报