On the source

Just execute this on the source host, for the « host » routes :


root@sourcehost#lsattr -El inet0 |awk '/host,/ {print "chdev -l inet0 -a route="$2}'
chdev -l inet0 -a route=host,-hopcount,0,-netmask,0,,,11.22.154.65,33.44.4.10
chdev -l inet0 -a route=host,-hopcount,0,-netmask,0,,,55.66.140.18,33.44.4.10
chdev -l inet0 -a route=host,-hopcount,0,-netmask,0,,,88.88.5.76,33.44.4.10
chdev -l inet0 -a route=host,-hopcount,0,-netmask,0,,,88.88.100.10,33.44.4.10
chdev -l inet0 -a route=host,-hopcount,0,,,,,,-static,1.2.37.103,33.44.4.10
chdev -l inet0 -a route=host,-hopcount,0,,,,,-static,1.2.37.123,33.44.4.10

Just execute this on the source host, for the « net » routes :

root@sourcehost# #lsattr -El inet0 |awk 'match($2,"^net") {print "chdev -l inet0 -a route="$2}'
chdev -l inet0 -a route=net,-hopcount,0,,,,,,88.88.138,33.44.4.10
chdev -l inet0 -a route=net,-hopcount,0,-netmask,255.255.255.0,,,,,-static,88.88.209.0,33.44.4.10
chdev -l inet0 -a route=net,-hopcount,0,-netmask,255.255.255.224,,,,,-static,1.2.37.96,33.44.4.10
chdev -l inet0 -a route=net,-hopcount,0,,-if,en0,,,,-static,33.44.0.0,33.44.4.10
chdev -l inet0 -a route=net,-hopcount,0,,0,3.4.24.3

 On the target

Just copy/paste the result on the target and voilà !

Share Button
1-liner: recreate a routing table from a similar host

2 thoughts on “1-liner: recreate a routing table from a similar host

Laisser un commentaire