graphviz是很强烈的描述语言绘图工具
安装:
1apt install graphviz 或 yum install graphviz
生成png
1dot -Tpng hn.gv -o hn.png
vi hg.gv
digraph MyGraph {
compound = true
margin="0,0"
ranksep = 1
nodesep = 1
rankdir=LR
{rank=same;防火墙;日志审计}
subgraph cluster_app {
label="海南应用"
rankdir=LR
margin = 10
{rank=same;app01;app02}
app01 [label="app01\n内网:192.168.0.10"]
app02 [label="app02\n内网:192.168.0.11"]
storage01 [label="storage01\n内网:192.168.0.30"]
subgraph cluster_db {
style = dotted
label="数据库主/备"
{rank=same;db02;db01}
db01 [label="db01\n内网:192.168.0.20"]
db02 [label="db02\n内网:192.168.0.21"]
db01 -> db02 [dir=both]
}
app01 -> db01 [splines=true,lhead=cluster_db]
app02 -> db01 [splines=true,lhead=cluster_db]
app01 -> storage01
app02 -> storage01
}
subgraph cluster_wjw {
label="卫健委"
style = dotted
margin = 10
{rank=same;front02;front01}
front01 [label="front01\n内网:192.168.0.5"]
front02 [label="front02\n内网:192.168.0.6"]
front01 -> front02 [dir=both]
}
堡垒机 [shape=box,style=rounded,color=red,fontname="wqy-microhei",fontcolor=black,fontsize=16,label="堡垒机\n外网:124.225.67.34\n内网:192.168.0.40"]
防火墙 [shape=box,style=filled,color=green,fontname="wqy-microhei",fontsize=16,label="防火墙\n外网:124.225.200.190\n内网:192.168.0.181"]
日志审计 [shape=box,style=filled,color=green,fontname="wqy-microhei", fontsize=16,label="日志审计\n外网:124.225.71.204\n内网:192.168.0.41"]
堡垒机 -> 防火墙
防火墙 -> 日志审计
防火墙 -> app01 [lhead = cluster_app]
storage01 -> front01 [ltail = cluster_app, lhead= cluster_wjw]
}
生成的图:
Ubuntu下命令行打开这图 xdg-open hn.png
厉害的工具,生成的手绘图: https://sketchviz.com/new