实验要求及拓扑
一、思路
1.创建vlan及配置接口工作模式(trunk、access)
2.给接口划分到那个vlan或者放通那个vlan
3.给三层交换机的vlan配置IP地址(相当于给vlan所在物理接口配置IP地址)
4.配置地址池给底下电脑分配IP
5.使用ospf共享三层交换机所有路由
二、操作
1.创建vlan及配置接口工作模式(trunk、access)及给接口划分到那个vlan或者放通那个vlan
lsw1:
vlan batch 2 to 4
interface Ethernet0/0/1
port link-type access
port default vlan 4
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
lsw2:
vlan batch 2 to 4
interface Ethernet0/0/1
port link-type access
port default vlan 4
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
lsw3:
vlan batch 2 to 3
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/2
port link-type access
port default vlan 2
interface Ethernet0/0/3
port link-type access
port default vlan 3
lsw4:
vlan batch 2 to 3
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/2
port link-type access
port default vlan 2
interface Ethernet0/0/3
port link-type access
port default vlan 3
2.给三层交换机的vlan配置IP地址(相当于给vlan所在物理接口配置IP地址)
lsw1:
interface Vlanif2
ip address 192.168.0.33 255.255.255.224
interface Vlanif3
ip address 192.168.0.65 255.255.255.224
lsw2:
interface Vlanif2
ip address 192.168.0.97 255.255.255.224
interface Vlanif3
ip address 192.168.0.129 255.255.255.224
3.配置地址池给底下电脑分配IP
lsw1:
dhcp enable
ip pool vlan2
gateway-list 192.168.0.33
network 192.168.0.32 mask 255.255.255.224
ip pool vlan3
gateway-list 192.168.0.65
network 192.168.0.64 mask 255.255.255.224
interface Vlanif2
dhcp select global
interface Vlanif3
dhcp select global
lsw2:
dhcp enable
ip pool vlan2
gateway-list 192.168.0.97
network 192.168.0.96 mask 255.255.255.224
ip pool vlan3
gateway-list 192.168.0.129
network 192.168.0.128 mask 255.255.255.224
interface Vlanif2
dhcp select global
interface Vlanif3
dhcp select global
4.使用ospf共享三层交换机所有路由
lsw1:
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
lsw2:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 0.0.0.0 255.255.255.255