Network topology with graphviz – Task 2.

Posted on March 20, 2012


Task 2.
List the interface name, the network address and the IP Address and the the DNS suffix.

IPSO Firewall ‘clish -c “show route direct”‘ output (filename: fw_direct_routes_firewall1.txt):

C     is directly connected, loop0c0
C    is directly connected, ae1c0
C    is directly connected, ae2c1
C    is directly connected, ae3c1


# awk -v myhostname="firewall1" '{print $6, $2, myhostname}' fw_direct_routes_firewall1.txt > fw_direct_routes_formatted_firewall1.txt


loop0c0 firewall1
ae1c0 firewall1
ae2c1 firewall1
ae3c1 firewall1

The “JOIN” Command:

# awk 'FNR==NR{myarray[$1]=$2 FS $3;next}{ print $0, myarray[$1]}' fw_ifname_ip_def_dom_firewall1.txt fw_direct_routes_formatted_firewall1.txt > fw_ifname_ip_def_dom_net_firewall1.txt


loop0c0 firewall1
ae1c0 firewall1 internal
ae2c1 firewall1 dmz1
ae3c1 firewall1 dmz2


FNR is the NR ofthe opened file. If a new file is opened it starts again from 1.
NR is the Number of Record. It runs till the last record of the last file.

# awk '{print FNR, NR, $0}' fw_ifname_ip_def_dom_firewall1.txt fw_direct_routes_formatted_firewall1.txt
1 1 ae1c0 internal
2 2 ae2c1 dmz1
3 3 ae3c1 dmz2
4 4 loop0c0
1 5 loop0c0 firewall1
2 6 ae1c0 firewall1
3 7 ae2c1 firewall1
4 8 ae3c1 firewall1

In case you have more the one firewall and they have interface on the same network, it is worth to collect this list in one file:

# cat fw_ifname_ip_def_dom_net_firewall1.txt >> fw_ifname_ip_def_dom_net_all.txt