有三层交换机网关配置在交换机就OK了
如果交换机是二层的,可以在路由器上面启用子接口,每个子接口就是每个VLAN的网关
三层交换机配置
enable
vlan database
vlan 10
vlan 20
vlan 30
vtp server (vtp同步,下面接交换机前提下)
vtp domain cisco (vtp 同步)
exit
conf t
int vlan 1
ip add 192.168.10.1 255.255.255.0
no sh
或
(三层
exit
ip routing
int f0/4
no switchport
ip add 192.168.10.1 255.255.255.0
no sh
)
int vlan 10
ip add 192.168.11.1 255.255.255.0
no sh
int vlan 20
ip add 192.168.12.1 255.255.255.0
int vlan 30
ip add 192.168.13.1 255.255.255.0
no sh
注:以下开始分配接口道那个VLAN
int f0/1
switchport mode access
switchport access vlan 10
int f0/2
switchport mode access
switchport access vlan 20
int f0/3
switchport mode access
switchport access vlan 30
end
路由器配置
enable
conf t
int f0/0
ip add 192.168.10.2 255.255.255.0
no sh
end
楼主的意思是不是想从路由器能访问Vlan10,Vlan20,Vlan30
如果是这样的话,要在路由器上加三条静态路由:
ip route 192.168.11.0 255.255.255.0 192.168.10.1
ip route 192.168.12.0 255.255.255.0 192.168.10.1
ip route 192.168.13.0 255.255.255.0 192.168.10.1
显然你说的是三层交换机,所以Vlan10,20,30之间本来就是能互访
三层交换机上加一条: 0.0.0.0 0.0.0.0 192.168.10.2。