实验拓扑图如下:
提前配置好主机ip地址及端口ip地址
备注:接PC、路由器、服务器的接口一般用access
LSW8三层交换机的配置:
#
sysname LSW8
#
vlan batch 20 30 40
#
interface Vlanif1
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
#
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
#
interface Vlanif40
ip address 192.168.40.254 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 40
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.30.0 0.0.0.255
network 192.168.40.0 0.0.0.255
network 192.168.20.0 0.0.0.255
#
LSW9三层交换机的配置:
#
sysname LSW9
#
vlan batch 20 50 60
#
interface Vlanif1
#
interface Vlanif20
ip address 192.168.20.2 255.255.255.0
#
interface Vlanif50
ip address 192.168.50.254 255.255.255.0
#
interface Vlanif60
ip address 192.168.60.254 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 50
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 60
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.50.0 0.0.0.255
network 192.168.60.0 0.0.0.255
network 192.168.20.0 0.0.0.255
#
各pc都互通: