拓扑图:包含vlan、地址规划
配置:
#
sysname jieru_A
#
vlan batch 10 20 30
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif10
ip address 172.16.10.2 255.255.255.0
#
interface Vlanif20
ip address 172.16.20.2 255.255.255.0
#
interface Vlanif30
ip address 172.16.30.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
ip route-static 0.0.0.0 0.0.0.0 192.168.128.44
ip route-static 192.168.128.40 255.255.255.248 172.16.10.1
ip route-static 192.168.128.40 255.255.255.248 172.16.30.1
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname jieru_B
#
vlan batch 10 20 30
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.2 255.255.255.0
#
interface Vlanif10
ip address 172.16.10.3 255.255.255.0
#
interface Vlanif20
ip address 172.16.20.3 255.255.255.0
#
interface Vlanif30
ip address 172.16.30.3 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.128.44
ip route-static 192.168.128.40 255.255.255.248 172.16.10.1
ip route-static 192.168.128.40 255.255.255.248 172.16.20.1
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname jieru_C
#
vlan batch 50 60 70
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.3 255.255.255.0
#
interface Vlanif50
ip address 172.18.50.2 255.255.255.0
#
interface Vlanif60
ip address 172.18.60.2 255.255.255.0
#
interface Vlanif70
ip address 172.18.70.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.129.44
ip route-static 192.168.129.40 255.255.255.248 172.18.50.1
ip route-static 192.168.129.40 255.255.255.248 172.18.60.1
ip route-static 192.168.129.40 255.255.255.248 172.18.70.1
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname jieru_D
#
vlan batch 50 60 70
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.4 255.255.255.0
#
interface Vlanif50
ip address 172.18.50.3 255.255.255.0
#
interface Vlanif60
ip address 172.18.60.3 255.255.255.0
#
interface Vlanif70
ip address 172.18.70.3 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
ip route-static 0.0.0.0 0.0.0.0 192.168.129.44
ip route-static 192.168.129.40 255.255.255.248 172.18.50.1
ip route-static 192.168.129.40 255.255.255.248 172.18.60.1
ip route-static 192.168.129.40 255.255.255.248 172.18.70.1
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname huiju_A
#
vlan batch 10 20 30 100
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.5 255.255.255.0
#
interface Vlanif10
ip address 172.16.10.1 255.255.255.0
#
interface Vlanif20
ip address 172.16.20.1 255.255.255.0
#
interface Vlanif30
ip address 172.16.30.1 255.255.255.0
#
interface Vlanif100
ip address 192.168.128.44 255.255.255.248
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
ospf 1
area 0.0.0.0
network 172.16.10.0 0.0.0.255
network 172.16.20.0 0.0.0.255
network 172.16.30.0 0.0.0.255
network 192.168.128.40 0.0.0.7
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname huiju_B
#
vlan batch 50 60 70 200
#
ip pool vlan1
gateway-list 192.168.0.254
#
interface Vlanif1
ip address 192.168.0.6 255.255.255.0
#
interface Vlanif50
ip address 172.18.50.1 255.255.255.0
#
interface Vlanif60
ip address 172.18.60.1 255.255.255.0
#
interface Vlanif70
ip address 172.18.70.1 255.255.255.0
#
interface Vlanif200
ip address 192.168.129.44 255.255.255.248
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
ospf 1
area 0.0.0.0
network 172.18.50.0 0.0.0.255
network 172.18.60.0 0.0.0.255
network 172.18.70.0 0.0.0.255
network 192.168.129.40 0.0.0.7
#
user-interface con 0
user-interface vty 0 4
#
return
#
sysname hexin_switch
#
vlan batch 100 200 300
#
interface Vlanif1
ip address 192.168.0.254 255.255.255.0
#
interface Vlanif100
ip address 192.168.128.45 255.255.255.248
#
interface Vlanif200
ip address 192.168.129.45 255.255.255.248
#
interface Vlanif300
ip address 192.168.86.17 255.255.255.240
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/10
port link-type access
port default vlan 300
#
ospf 1
import-route direct
area 0.0.0.0
network 192.168.86.16 0.0.0.15
network 192.168.128.40 0.0.0.7
network 192.168.129.40 0.0.0.7
#
user-interface con 0
user-interface vty 0 4
#
return
[router-GigabitEthernet0/0/0]dis cu
#
sysname router
#
acl number 2000
rule 10 permit
#
interface GigabitEthernet0/0/0
ip address 192.168.86.30 255.255.255.240
nat static protocol tcp global 210.96.100.86 any inside 192.168.86.30 any netma
sk 255.255.255.255
#
interface GigabitEthernet0/0/1
ip address 210.96.100.85 255.255.255.252
nat outbound 2000
#
ospf 1
import-route direct
area 0.0.0.0
network 210.96.100.84 0.0.0.3
network 192.168.86.16 0.0.0.15
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
return
这个实例只做到全网通就可以,可以基本了解单核心网络架构的问题。通过二层vlan和三层vlan实现全网通,路由器和交换机采用ospf,在后期的学习中自己可以加入备份、acl、nat等功能。