华为S5700三层交换机基本配置
> 登录到交换机之后,就开始配置吧。以下配置中,绿色字体是需要自定义的。
命令是不区分大小写的设置设备的名称为SW1
system-view
system-view
[Quidway] sysname SW1
设置查看设备的时区,时间设置当前时间:clock datetime HH:MM:SS YYYY-MM-DD设置时区: clock timezone time-zone-name { add | minus } offset> 注意这里是 <用户> 视图
clock timezone BJ add 8
clock timezone BJ add 8
clock datetime 18:20:30 2011-06-08
clock timezone BJ add 8
clock datetime 18:20:30 2011-06-08
display clock
作为ntp客户端:设定NTP服务器,自动获取更新时间,假设NTP服务器为 202.120.2.101,202.112.10.36 system-view
[Quidway] ntp-service unicast-peer 202.120.2.101
[Quidway] ntp-service unicast-peer 202.112.10.36
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 172.168.0.2
#
interface Vlanif20
ip address 192.168 .1.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 172.168.0.2
#
interface Vlanif30
ip address 192.168. 2.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 172.168.0.2
#
interface Vlanif40
ip address 172.168.0.1 255.255.255.0
这时交换机要通过路由器访问外网,需要配置静态路由,所有出去的包都丢给路由 ip route 0.0.0.0 0.0.0.0 172.168.0.2> 下面在路由器上面配置 > 三层交换机Vlan间默认互通
sysname R1
#
vlan batch 10 20 30 40
#
dhcp enable
#
ip pool vlan10
gateway-list 192.168.0.1
network 192.168.0.0 mask 255.255.255.0
excluded-ip-address 192.168.0.100 192.168.0.254
DNS-list 192.168.0.1
#
ip pool vlan2
gateway-list 192.168.1.1
network 192.168.1.0 mask 255.255.255.0
lease day 2 hour 12 minute 30
dns-list 192.168.1.1
#
ip pool vlan30
gateway-list 192.168.2.1
network 192.168.2.0 mask 255.255.255.0
dns-list 192.168.2.1
#
interface Vlanif10
#
interface GigabitEthernet0/0/0
ip address 172.168.0.2 255.255.255.0
dhcp select global
#还要回写去交换机的路由
#
ip route 192.168.0.0 255.255.255.0 172.168.0.1
ip route 192.168.1.0 255.255.255.0 172.168.0.1
ip route 192.168.2.0 255.255.255.0 172.168.0.1
设置完成。就可以查看PC机IP地址。