最近,入手一台H3CS3600V2-SI鼓捣了大半个月终于是按照BOSS的要求配好.大部分时间都花在查官方文档和售后Email上,效率极低.如果基础知识,扎实感觉有一个星期完全足够了!下面就来总结一下:

组网需求及内网信息收集:

 

wKiom1Q_arfBbAeaAAKQVP0Pq_Q548.jpg

1,

Vlan2使用192.168.2.0网段,服务器,通过HUB接到e1/0/10

Vlan3使用192.168.3.0网段,研发部,通过HUB接到e1/0/11

Vlan4使用192.168.4.0网段,运营部,通过HUB接到e1/0/12

Vlan20使用192.168.20.0做端口镜像抓包

2,

需要把2网段的FTP和2个业务端口映射到外网,2,3网段又必须外网隔离,

VLAN2,3,4之间不能互访

Vlan2,3要访问192.168.2.253:8000

Vlan2,3要访问192.168.2.245:8080

192.168.2.0192.168.3.031104-31109,要互通

192.168.3.0要能访问2.021000 ,21001

2网段3389和部分其他端口要被3网段指定机器访问

3,

Acl3001作用在vlan10 outbound 即交换机出口方向

Acl3020作用在vlan2 inbound

Acl3030作用在vlan3 inbound

Acl3040 作用在vlan4 inbound

 

 

 

一首先需要配置ssh,web管理接口和用户配置

不通的命令需要注意在不同视图才能使用.管理级别有0,1,2,3四个级别从低到高

# 在交换机上创建VLAN接口,并为其分配IP地址192.168.0.2,作为客户端连接的SSH服务器地址

system-view

interface vlan-interface 10

ip address 192.168.0.2 255.255.255.0

quit

#生成服务器端的RSADSA密钥对是完成SSH登录的必要操作。

public-key local create rsa

public-key local create dsa

# 设置用户接口上的认证模式为本地认证。

user-interface vty 15

authentication-mode scheme

# 设置用户接口上支持SSH协议。

protocol inbound ssh

quit

# 创建用户admin,设置认证密码为abc,登录协议为SSH,能访问的命令级别为3

local-user admin

password simple abc

service-type ssh level 3

quit

# 指定用户admin的认证方式为password

ssh user admin authentication-type password

 

# 开启http服务用户级别设为3(管理级用户)

system-view

ip http shutdown

local-user admin

service-type web level 3

quit

 

 

创建基于端口的vlan

1,VLAN2

# 创建VLAN2,并配置VLAN2的描述字符串为“fuwuqi”,将端口Ethernet1/0/10加入到VLAN2,

# 创建VLAN2接口IP地址,VLAN网关192.168.2.1VLANPC的报文进行转发.由于没有使用到链路等高级功能端口使用默认ACCESS类型(如需要改变端口链路类型使用port link-type { access | hybrid | trunk })

system-view

vlan 2

description fuwuqi

port Ethernet 1/0/10

quit

interface Vlan-interface 2

ip address 192.168.2.0 24

quit

 

2,VLAN3

system-view

vlan 3

description yanfabu

port Ethernet 1/0/11

quit

interface Vlan-interface 3

ip address 192.168.3.0 24

quit

 

3,VLAN4

system-view

vlan 4

description yunyingbu

port Ethernet 1/0/12

quit

interface Vlan-interface 4

ip address 192.168.4.0 24

quit

 

4,VLAN20

system-view

vlan 20

description mirror

port Ethernet 1/0/20

quit

interface Vlan-interface 20

ip address 192.168.20.0 24

quit

 

 

制作端口镜像,以便组网过程中的调试,排除的抓包.注意:镜像端口不能是和被镜像端口在一个VLAN,所以单独建了一个VLAN20

# 创建本地镜像组。

system-view

mirroring-group 1 local

# 为本地镜像组配置源端口和目的端口。

mirroring-group 1 mirroring-port Ethernet 1/0/10 Ethernet 1/0/11 Ethernet 1/0/12 both

mirroring-group 1 monitor-port Ethernet 1/0/20

 

 

 

二设置ACL规则

1,对ACL规则写起来很简单,注意的是首先要想好是作用在进来的方向(inbound)还是出去的方向(outbound)

# 配置外网限制,禁止VLAN2,3的报文通过。并作用到VLAN10(rule不用编号,会以默认步长5进行递增编号)

system-view

acl number 3001

 rule permit tcp source 192.168.2.247 0 source-port eq ftp   #允许来至192.168.247的FTP端口数据包出去
 rule permit tcp source 192.168.2.248 0 source-port eq 21000
 rule permit tcp source 192.168.2.249 0 source-port eq 21001
 rule deny ip source 192.168.2.0 0.0.0.255        #拒绝来至VLAN2的数据包从这里出去
 rule deny ip source 192.168.3.0 0.0.0.255       

quit

int vlan 10

packet-filter 3001 outbound             #作用在outbound

 

2,对不同VLANACL规则,因为需要对指定端口进行放行所以使用高级ACL,需要注意放行的rule需要到对应的VLAN做反向rule per

3020

wKioL1Q_Z1iSVufbAAnGrMhOg7U400.jpg

 

3030

 wKiom1Q_Z0GDJg_rAArGV1fEeqQ755.jpg

3040

 

 wKioL1Q_Z4ewHzOaAAGpIoksyfU443.jpg

3,vlan上作用对应的ACL

sys

interface Vlan-interface 2

packet-filter 3020 inbound

quit

interface Vlan-interface 3

packet-filter 3030 inbound

quit

interface Vlan-interface 2

packet-filter 3040 inbound

quit

save s

 

 

到这里基本配置就完成了,最后使用save命令将配置保存为默认配置.

 

 PS:

1,实际使用中命令可以很精简的输入,只要保证你精简的内容是独一无二的.例如:

packet-filter 3040 inbound >> pac 3020 in

acl number 2000 >> a n 2000

rule permit tcp source 192.168.3.20 0 destination 192.168.2.247 0 destination-port eq 3389 >> rule per t s 192.168.3.20 0 des 192.168.2.247 0 des e 3389

system-view >> sys

2,小技巧可以使用TAB键进行命令的自动补全,或者输入?号查看帮助.

3,dis cu查看交换机主配置,同样dis命令也可以查看其他的独立项信息,用法

dis acl all

dis acl 3020

dis int vlan

4,任何时候都可以使用?号.比如我想输入interface但是忘了拼写.

wKioL1Q_aGeC-OGVAAAaJMhpyoY530.jpg

当然问号也可以用在dis命令,功能相当强大