通过OSPF组网案例
网络拓扑
组网说明
1、Cloud1连接本地网络,AR路由器自动获取IP
2、LSW1交换机OSPF与路由器组网
3、LSW2交换机OSPF与LSW1交换机1组网
4、PC1和PC2分配各自网段IP
效果
1、PC1与PC2互通
2、PC1和PC可以联网外网
配置
路由器配置
只配置Area0连接,其它通过路由引入直连,路由器配置默认路由
#
sysname AR1
#
dns resolve
dns server 223.5.5.5
#
vlan batch 188
#
dhcp enable
#
acl number 3999
rule 99999 permit ip
#
interface Vlanif188
ip address 192.168.88.1 255.255.255.252
#
interface Ethernet0/0/0
port link-type trunk
port trunk allow-pass vlan 188
#
interface GigabitEthernet0/0/0
nat outbound 3999
ip address dhcp-alloc
#
ospf 1
default-route-advertise always
import-route direct
area 0.0.0.0
network 192.168.88.0 0.0.0.3
LSW1配置
只配置Area0连接,其它通过路由引入直连。
#
sysname LSW1
#
dns resolve
dns server 223.5.5.5
#
vlan batch 90 188 to 189
#
interface Vlanif90
ip address 192.168.90.1 255.255.255.0
#
interface Vlanif188
ip address 192.168.88.2 255.255.255.252
#
interface Vlanif189
ip address 192.168.88.5 255.255.255.252
#
interface Ethernet0/0/1
port link-type access
port default vlan 90
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 188
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 189
#
ospf 1
import-route direct
area 0.0.0.0
network 192.168.88.0 0.0.0.3
network 192.168.88.4 0.0.0.3
LSW2配置
只配置Area0连接,其它通过路由引入直连。
#
sysname LSW2
#
vlan batch 91 189
#
interface Vlanif91
ip address 192.168.91.1 255.255.255.0
#
interface Vlanif189
ip address 192.168.88.6 255.255.255.252
#
interface Ethernet0/0/1
port link-type access
port default vlan 91
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 189
#
ospf 1
import-route direct
area 0.0.0.0
network 192.168.88.4 0.0.0.3