conf t
int f0/1
no sw
ip add 192.168.1.1 255.255.255.0
int f0/2
no sw
ip add 192.168.2.1 255.255.255.0
exit
pc1 192.168.1.2
pc2 192.168.2.2
三层交换机配置如下
特权模式下创建vlan
vlan database
vlan 2
vlan 3
全局模式下将端口划分到vlan
interface fastethernet0/1
switchport access vlan 2
interface fastethernet0/2
switchport access vlan 3
开启三层交换机路由端口并配置ip地址
interface fastethernet0/1
no switchport
ip address 192.168.1.1 255.255.255.0
interface fastethernet0/2
no switchport
ip address 192.168.2.1 255.255.255.0