小三层架构配置实现

小三层架构配置实现_第1张图片

配置步骤:

①Eth-trunk(channel)        ②vlan        ③access/trunk       

④mstp        ⑤svi        ⑥vrrp        ⑦dhcp        ⑧路由

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

①Eth-trunk

interface Eth-Trunk 0 
trunkport g 0/0/1 to 0/0/2
或
interface g 0/0/1
eth-trunk 0
interface g 0/0/2
eth-trunk 0

②vlan

在4个交换机上均创建vlan2,vlan1默认存在 

③access/trunk 

[acc-sw1-Ethernet0/0/22]

interface Ethernet0/0/22
 port link-type access
 stp edged-port enable    //stp边缘接口


[acc-sw1-Ethernet0/0/21]display this 

interface Ethernet0/0/21
 port link-type access
 port default vlan 2
 stp edged-port enable

[acc-sw1-GigabitEthernet0/0/1]display this 

interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2


[acc-sw1-GigabitEthernet0/0/2]display this 

interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2
[con-sw1-GigabitEthernet0/0/3]display this 
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2
#
[con-sw1-GigabitEthernet0/0/4]display this 
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 2
#
[con-sw1-Eth-Trunk0]display this 
#
interface Eth-Trunk0
 port link-type trunk
 port trunk allow-pass vlan 2

④mstp

stp mode mstp
stp region-configuration 
region-name 3c
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
// 四个交换机上述配置相同,此外汇聚层交换机上还要定义主备根
[con-sw1] 
stp instance 1 root primary
stp instance 2 root secondary
[con-sw2] 
stp instance 1 root secondary
stp instance 2 root primary

 ⑤svi

[con-sw1]
interface Vlanif1
 ip address 192.168.1.1 255.255.255.0
interface Vlanif2
 ip address 192.168.1.2 255.255.255.0

[con-sw2]
interface Vlanif1
 ip address 192.168.2.1 255.255.255.0
interface Vlanif2
 ip address 192.168.2.2 255.255.255.0

⑥vrrp 

[con-sw1-Vlanif1] 
 vrrp vrid 1 virtual-ip 192.168.1.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface GigabitEthernet0/0/7 reduced 30
[con-sw1-Vlanif2] 
 vrrp vrid 1 virtual-ip 192.168.2.254


[con-sw2-Vlanif1]
 vrrp vrid 1 virtual-ip 192.168.1.254
[con-sw2-Vlanif2]
 vrrp vrid 2 virtual-ip 192.168.2.254
 vrrp vrid 2 priority 120
 vrrp vrid 2 track interface GigabitEthernet0/0/7 reduced 30

⑦dhcp

ip pool v1
 gateway-list 192.168.1.254
 network 192.168.1.0 mask 255.255.255.0
 dns-list 114.114.114.114
#
ip pool v2
 gateway-list 192.168.2.254
 network 192.168.2.0 mask 255.255.255.0
 dns-list 114.114.114.114

// con-sw1和con-sw2配置相同,可以dis curr直接copy过去
// 之后要在svi接口 dhcp select global

⑧路由

[con-sw1-Vlanif100] 
 ip address 172.16.1.1 255.255.255.0

[con-sw2-Vlanif100] 
 ip address 172.16.2.1 255.255.255.0
[con-sw1-GigabitEthernet0/0/7]
 port link-type access
 port default vlan 100
 stp edged-port enable

[con-sw2-GigabitEthernet0/0/7]
 port link-type access
 port default vlan 100
 stp edged-port enable
[core-AR1]

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.1/24          up         up        
GigabitEthernet0/0/1              172.16.1.2/24        up         up        
GigabitEthernet0/0/2              172.16.2.2/24        up         up        
NULL0                             unassigned           up         up(s)
[ISP]

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s)  

--- 启动ospf

[core-AR1-ospf-1-area-0.0.0.0]
#
 area 0.0.0.0 
  network 172.16.1.2 0.0.0.0 
  network 172.16.2.2 0.0.0.0 
[con-sw1-ospf-1-area-0.0.0.0]
 area 0.0.0.0
  network 172.16.1.1 0.0.0.0

[con-sw1-ospf-1-area-0.0.0.1]
 area 0.0.0.1
  network 192.168.1.0 0.0.0.255
  network 192.168.2.0 0.0.0.255


[con-sw2-ospf-1-area-0.0.0.0]
 area 0.0.0.0
  network 172.16.2.1 0.0.0.0

[con-sw2-ospf-1-area-0.0.0.1]
 area 0.0.0.1
  network 192.168.1.0 0.0.0.255
  network 192.168.2.0 0.0.0.255

可以在区域1将下面的两条路由汇总成一条发上去

abr-summary 192.168.0.0 255.255.0.0
// con-sw1和con-sw2配置相同

在core-AR1上写一条缺省指向ISP并在ospf中下发缺省

ip route-static 0.0.0.0 0 12.1.1.2 

[core-AR1-ospf-1]
 default-route-advertise

NAT

acl number 2000  
 rule 5 permit source 192.168.0.0 0.0.255.255 

[core-AR1-GigabitEthernet0/0/0]
 nat outbound 2000

沉默接口

con-sw1和con-sw2的g0/0/3和g0/0/4会一直发hello包 

[con-sw1-ospf-1]silent-interface g 0/0/3

你可能感兴趣的:(网络)