创建graphviz树图 - 一对一映射

时间:2012-01-28 19:16:58

标签: graphviz dot

尝试创建网络图(host-> open_port - >服务)。当我在下面的示例图表中,我最终得到一个(many_host - > one_port - > many_services)。

我如何隔离这个,我有一个图表显示每个主机上的每个开放端口与该端口上的单独服务?类似的东西:

"10.0.0.1": 
    "25" -> "smtp" -> "sendmail version_x"
    "53" -> "domain" -> "dnsmasq"
    "443" -> "https" -> "Apache 1.3"

"10.0.0.2"  
    "25" -> "smtp" -> "postfix version_x"

"10.0.0.3" 
    "25" -> "smtp" -> "sendmail version_y"
    "53" -> "domain" -> "dnsmasq"
    "443" -> "https" -> "Apache 2.0"

"10.0.0.4" 
    "25" -> "smtp" -> "sendmail version_y"

- 样品-------

digraph "map"{
rankdir=LR

subgraph cluster0{
"10.0.0.1" -> "25" -> "smtp" -> "sendmail version_x"
"10.0.0.1" -> "53" -> "domain" -> "dnsmasq 2.45 "
"10.0.0.1" -> "443" -> "https" -> "Apache 1.3"
}
subgraph cluster1{
"10.0.0.2" -> "25" -> "smtp" -> "postfix version_x"

subgraph cluster2{
"10.0.0.3" -> "25" -> "smtp" -> "sendmail version_y"
"10.0.0.3" -> "53" -> "domain" -> "dnsmasq 2.45 "
"10.0.0.3" -> "443" -> "https" -> "Apache 2.0"
}
subgraph cluster3{
"10.0.0.4" -> "25" -> "smtp" -> "sendmail version_y"

1 个答案:

答案 0 :(得分:1)

只需添加端口/服务/等。使用IP并将标签设置为端口号

"10.0.0.3:25" [label="25"] ;
"10.0.0.3.smtp" [label="smtp"] ;
"10.0.0.3" -> "10.0.0.3:25" -> "10.0.0.3.smtp" ...