A-A+

H3C的官方文档和基础配置篇

2015年12月25日 站长资讯 暂无评论

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

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网段的FTP和2个业务端口映射到外网,2,3网段又必须外网隔离,

VLAN2,3,4之间不能互访

Vlan2,3要访问192.168.2.253:8000

Vlan2,3要访问192.168.2.245:8080

192.168.2.0和192.168.3.0的31104-31109,要互通

192.168.3.0要能访问2.0的21000 ,21001

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

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

Acl3020作用在vlan2 inbound

Acl3030作用在vlan3 inbound

Acl3040 作用在vlan4 inbound

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

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

  1. # 在交换机上创建VLAN接口,并为其分配IP地址192.168.0.2,作为客户端连接的SSH服务器地址  
  2. system-view  
  3. interface vlan-interface 10  
  4. ip address 192.168.0.2 255.255.255.0  
  5. quit  
  6. #生成服务器端的RSA和DSA密钥对是完成SSH登录的必要操作。  
  7. public-key local create rsa  
  8. public-key local create dsa  
  9. # 设置用户接口上的认证模式为本地认证。  
  10. user-interface vty 15  
  11. authentication-mode scheme  
  12. # 设置用户接口上支持SSH协议。  
  13. protocol inbound ssh  
  14. quit  
  15. # 创建用户admin,设置认证密码为abc,登录协议为SSH,能访问的命令级别为3。  
  16. local-user admin  
  17. password simple abc  
  18. service-type ssh level 3  
  19. quit  
  20. # 指定用户admin的认证方式为password  
  21. ssh user admin authentication-type password  
  22.    
  23. # 开启http服务用户级别设为3(管理级用户)  
  24. system-view  
  25. ip http shutdown  
  26. local-user admin  
  27. service-type web level 3  
  28. quit  

创建基于端口的vlan

1,VLAN2

  1. # 创建VLAN2,并配置VLAN2的描述字符串为“fuwuqi”,将端口Ethernet1/0/10加入到VLAN2,  
  2. # 创建VLAN2接口IP地址,即VLAN网关192.168.2.1对VLAN内PC的报文进行转发.由于没有使用到链路等高级功能端口使用默认ACCESS类型(如需要改变端口链路类型使用port link-type { access | hybrid | trunk })  
  3. system-view  
  4. vlan 2  
  5. description fuwuqi  
  6. port Ethernet 1/0/10  
  7. quit  
  8. interface Vlan-interface 2  
  9. ip address 192.168.2.0 24  
  10. quit  

2,VLAN3

  1. system-view  
  2. vlan 3  
  3. description yanfabu  
  4. port Ethernet 1/0/11  
  5. quit  
  6. interface Vlan-interface 3  
  7. ip address 192.168.3.0 24  
  8. quit  

3,VLAN4

  1. system-view  
  2. vlan 4  
  3. description yunyingbu  
  4. port Ethernet 1/0/12  
  5. quit  
  6. interface Vlan-interface 4  
  7. ip address 192.168.4.0 24  
  8. quit  

4,VLAN20

  1. system-view  
  2. vlan 20  
  3. description mirror  
  4. port Ethernet 1/0/20  
  5. quit  
  6. interface Vlan-interface 20  
  7. ip address 192.168.20.0 24  
  8. quit  

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

  1. # 创建本地镜像组。  
  2. system-view  
  3. mirroring-group 1 local  
  4. # 为本地镜像组配置源端口和目的端口。  
  5. mirroring-group 1 mirroring-port Ethernet 1/0/10 Ethernet 1/0/11 Ethernet 1/0/12 both  
  6. mirroring-group 1 monitor-port Ethernet 1/0/20  

二设置ACL规则

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

  1. # 配置外网限制,禁止VLAN2,3的报文通过。并作用到VLAN10(rule不用编号,会以默认步长5进行递增编号)  
  2. system-view http://www.xiaoxiongboke.com/  
  3. acl number 3001  
  4.  rule permit tcp source 192.168.2.247 0 source-port eq ftp   #允许来至192.168.247的FTP端口数据包出去  
  5.  rule permit tcp source 192.168.2.248 0 source-port eq 21000  
  6.  rule permit tcp source 192.168.2.249 0 source-port eq 21001  
  7.  rule deny ip source 192.168.2.0 0.0.0.255        #拒绝来至VLAN2的数据包从这里出去   
  8.  rule deny ip source 192.168.3.0 0.0.0.255         
  9. quit  
  10. int vlan 10  
  11. packet-filter 3001 outbound             #作用在outbound  

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

3020

3030

3040

3,在vlan上作用对应的ACL

  1. sys  
  2. interface Vlan-interface 2  
  3. packet-filter 3020 inbound  
  4. quit  
  5. interface Vlan-interface 3  
  6. packet-filter 3030 inbound  
  7. quit  
  8. interface Vlan-interface 2  
  9. packet-filter 3040 inbound  
  10. quit  
  11. save s  

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

PS:

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

  1. packet-filter 3040 inbound >> pac 3020 in  
  2. acl number 2000 >> a n 2000  
  3. 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  
  4. system-view >> sys  

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

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

dis acl all

dis acl 3020

dis int vlan

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

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

标签:

给我留言