>#config
int vlan 1
\进入vlan1,vlan 1
是默认存在的,你不能改名字,也不能删除.你也可以建个新的vlan做你的管理口.
ip add 192.168.254.254 255.255.255.0 \设置vlan 1
的ip
no shut
\启用vlan1
exit
以下的你要配置4遍,因为你有4个vlan:
vlan 10
\创建vlan 10
name xxx \给vlan 10命名
no shut
\启用
exit
int vlan 10
\进入vlan 10
ip add 192.168.1.1 255.255.255.0
\设置vlan 10的IP
no shut
\启用,一下省略了
exit
int range g0/2-3
\进入端口2-3,range是在设置多端口的时候才用,配置一个端口的时候不需要的.如果你的3750的都是千兆口,那就是g0/2-3,如果是百兆口的,就是Fa0/2-3了.
switchport access vlan 10
\设置端口接收vlan10的信息.
switchport mode access
\设置端口模式
no shut
exit
vlan 20
name xxx
no shut
exit
int vlan 20
ip add 192.168.2.1 255.255.255.0
no shut
exit
int range g0/6-10
switchport access vlan 20
switchport mode access
no shut
exit
vlan 30
name xxx
no shut
exit
int vlan 30
ip add 192.168.3.1 255.255.255.0
no shut
exit
int g0/11
switchport access vlan 20
switchport mode access
no shut
exit
vlan 40
name xxx
no shut
exit
int vlan 40
ip add 192.168.4.1 255.255.255.0
no shut
exit
int g12
switchport access vlan 40
switchport mode access
no shut
exit
ip route 0.0.0.0 0.0.0.0 192.168.254.1
\设置默认路由:
ip routing
\开启路由功能
到这里就差不多了,不过还要设置一个trunk口,看你分的端口,就放在1口吧.
还在config配置模式下:
int g0/1
switchport mode trunk
\设置端口1为trunk模式.
switchport trunk allow vlan all
\设置端口1为允许所有vlan通过
switchport
trunk enca
dot1q \设置treunk的通信协议,dto1q是802.1q的,用这个的话,以后还可以连其他厂商的设备!
no shut
exit
好了,然后还要设置个dhcp,
还是在config配置模式下:
ip dhcp excluded-address 192.168.1.1
\设置sdhp不在自动分配之内的地址
ip dhcp excluded-address 192.168.1.254
\设置sdhp不在自动分配之内的地址
ip dhcp excluded-address 192.168.2.1
ip dhcp excluded-address 192.168.2.254
ip dhcp excluded-address 192.168.3.1
ip dhcp excluded-address 192.168.3.254
ip dhcp excluded-address 192.168.4.1
ip dhcp excluded-address 192.168.4.254
ip dhcp pool vlan1
\命名dhcp的地址池名称
network 192.168.1.0
255.255.255.0
\设置dhcp的网络
default-router
192.168.1.1
\设置dhcp的默认网关,都是vlan的ip.
dns-server 202.96.209.5
202.96.209.6 \设置dhcp获取的ip的dns,如果内网有dns服务器的话,就改成自己的dns服务器的ip
lease 3
\设置dhcp的租期,千万不要设置大的时间,否则有新的机器加入这个vlan,就没有IP给再加入这个vlan的IP了.
end
conf t
ip dhcp pool vlan2
network 192.168.2.0
255.255.255.0
default-router
192.168.2.1
dns-server 202.96.209.5
202.96.209.6
lease
3
end
conf t
ip dhcp pool vlan3
network 192.168.3.0
255.255.255.0
default-router
192.168.3.1
dns-server 202.96.209.5
202.96.209.6
lease
3
end
conf t
ip dhcp pool vlan4
network 192.168.4.0
255.255.255.0
default-router
192.168.4.1
dns-server 202.96.209.5
202.96.209.6
lease
3
end
保存配置:
copy run start
交换机上OK了,防火墙上:
防火墙上配置静态路由
192.168.0.0 255.255.0.0 192.168.254.254
\让所有192.168开头的地址
都从192.168.254.254走.
然后把防火墙的lan口和3750的g0/1口连接就可以了.