路由器命令:

interface GigabitEthernet0/0/0.100
 dot1q termination vid 100(子接口对应VLAN的编号)
 ip address 192.168.100.1 255.255.255.0
#
interface GigabitEthernet0/0/0.200
 dot1q termination vid 200(子接口对应VLAN的编号)
 ip address 192.168.200.1 255.255.255.0

交换机命令:

interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 200
#