现有一台华为s5700交换机和普通交换机数台,以及tp-link路由器一台。
1.tp-link路由器连接外网。
2.s5700交换机划分vlan。
3.普通交换机接vlan和pc端。
网络拓扑图如下:
配置说明:
s5700默认有vlan1所有端口都在vlan1里面。
vlanif1配置路由器网段ip用于连接路由器。
三层交换机要配置一条指向路由器的静态路由。
路由器要配置nat对应个vlan ip。
路由器要配置路由到各个vlan网段。
1.s5700交换机web管理ip和用户配置。
使用Console线缆将计算机连接至交换机的Console口。
在计算机上打开终端仿真软件,新建连接,设置连接的端口以及通信参数。计算机终端的通信参数配置要和交换机Console口的缺省配置保持一致,交换机Console口的缺省配置如下:
传输速率:9600
数据位:8
校验方式:无
停止位:1
流控方式:无
按Enter键,直到仿真终端出现如下显示,提示用户配置验证密码。
Please configure the login password (6-16)
Enter Password:123456789
Confirm Password:123456789
配置交换机的管理IP。
system-view
interface meth 0/0/1
ip address 10.255.4.100 24
quit
quit
save
配置web登陆用户信息。
system-view
aaa
local-user admin password cipher [email protected]
local-user admin privilege level 15
local-user admin service-type http ftp
local-user admin ftp-directory flash:
quit
quit
save
使用网线将计算机与交换机的ETH口相连,配置计算机上的IP。在尚未使用的IP地址范围内选择IP地址,如10.255.4.50。
打开一个Web浏览器窗口。在地址栏中输入10.255.4.50,即交换机IP地址,然后按Enter键。系统将显示登录界面。
2.s5700vlan划分和设置。
console登陆交换机,按enter键输入密码:123456789。
设置端口的接入方式和所属的vlan
system-view
interface GigabitEthernet 0/0/1
port link-type access
quit
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 2
quit
interface GigabitEthernet 0/0/3
port link-type access
port default vlan 3
quit
interface GigabitEthernet 0/0/4
port link-type access
port default vlan 4
quit
interface GigabitEthernet 0/0/5
port link-type access
port default vlan 5
quit
interface GigabitEthernet 0/0/6
port link-type access
port default vlan 6
quit
interface GigabitEthernet 0/0/7
port link-type access
port default vlan 7
quit
interface GigabitEthernet 0/0/8
port link-type access
port default vlan 8
quit
interface GigabitEthernet 0/0/9
port link-type access
port default vlan 9
quit
interface GigabitEthernet 0/0/10
port link-type access
port default vlan 10
quit
interface GigabitEthernet 0/0/11
port link-type access
port default vlan 11
quit
interface GigabitEthernet 0/0/12
port link-type access
port default vlan 12
quit
interface GigabitEthernet 0/0/13
port link-type access
port default vlan 13
quit
interface GigabitEthernet 0/0/14
port link-type access
port default vlan 14
quit
interface GigabitEthernet 0/0/15
port link-type access
port default vlan 15
quit
interface GigabitEthernet 0/0/16
port link-type access
port default vlan 16
quit
interface GigabitEthernet 0/0/17
port link-type access
port default vlan 17
quit
interface GigabitEthernet 0/0/18
port link-type access
port default vlan 18
quit
interface GigabitEthernet 0/0/19
port link-type access
port default vlan 19
quit
interface GigabitEthernet 0/0/20
port link-type access
port default vlan 20
quit
interface GigabitEthernet 0/0/21
port link-type access
port default vlan 21
quit
interface GigabitEthernet 0/0/22
port link-type access
port default vlan 22
quit
interface GigabitEthernet 0/0/23
port link-type access
port default vlan 23
quit
interface GigabitEthernet 0/0/24
port link-type access
port default vlan 24
quit
quit
save
reboot
添加vlan和端口
system-view
vlan 2
port GigabitEthernet 0/0/2
vlan 3
port GigabitEthernet 0/0/3
vlan 4
port GigabitEthernet 0/0/4
vlan 5
port GigabitEthernet 0/0/5
vlan 6
port GigabitEthernet 0/0/6
vlan 7
port GigabitEthernet 0/0/7
vlan 8
port GigabitEthernet 0/0/8
vlan 9
port GigabitEthernet 0/0/9
vlan 10
port GigabitEthernet 0/0/10
vlan 11
port GigabitEthernet 0/0/11
vlan 12
port GigabitEthernet 0/0/12
vlan 13
port GigabitEthernet 0/0/13
vlan 14
port GigabitEthernet 0/0/14
vlan 15
port GigabitEthernet 0/0/15
vlan 16
port GigabitEthernet 0/0/16
vlan 17
port GigabitEthernet 0/0/17
vlan 18
port GigabitEthernet 0/0/18
vlan 19
port GigabitEthernet 0/0/19
vlan 20
port GigabitEthernet 0/0/20
vlan 21
port GigabitEthernet 0/0/21
vlan 22
port GigabitEthernet 0/0/22
vlan 23
port GigabitEthernet 0/0/23
vlan 24
port GigabitEthernet 0/0/24
quit
quit
save
启用dhcp
system-view
dhcp enable
quit
save
配置vlanif接口ip
system-view
interface vlanif 1
ip address 10.255.40.30 24
quit
interface vlanif 2
ip address 10.255.2.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 3
ip address 10.255.3.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 4
ip address 10.255.5.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 5
ip address 10.255.6.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 6
ip address 10.255.7.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 7
ip address 10.255.8.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 8
ip address 10.255.9.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 9
ip address 10.255.10.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 10
ip address 10.255.11.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 11
ip address 10.255.12.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 12
ip address 10.255.13.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 13
ip address 10.255.14.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 14
ip address 10.255.15.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 15
ip address 10.255.16.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 16
ip address 10.255.17.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 17
ip address 10.255.18.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 18
ip address 10.255.19.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 19
ip address 10.255.20.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
interface vlanif 20
ip address 10.255.21.1 24
dhcp select interface
dhcp server dns-list 114.114.114.114
quit
quit
save
配置静态路由到路由器
system-view
ip route-static 0.0.0.0 0.0.0.0 10.255.40.1
quit
save
3.路由器设置。
用默认ip192.168.1.1 用户名admin密码admin登陆路由器。
选择接口设置--wan口设置,根据自己的情况选择联网方式。
选择接口设置--lan口设置,设置ip为10.255.40.1掩码255.255.255.0 。
选择接口设置--lan口设置--dhcp服务,启用dhcp。
选择传输控制--转发规则--多网段NAT,网段地址设置各个vlan配置的ip。
选择传输控制--路由设置,新增路由到各个vlan口,下一跳地址为vlan1 ip。
这些设置完成后,各个vlan之间能平通,各vlan能平通vlan1,各vlan能ping通路由器,各vlan能ping通www.baidu.com 。 vlan划分完成。