Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- == DNS/DHCP migration one-liners ==
- -----------------------------------------------
- Generate a list of DNS reverse lookup pointers
- -----------------------------------------------
- # this creates something like:
- # 5 IN PTR host1.my.domain.com.
- # 6 IN PTR host2.my.domain.com.
- # 7 IN PTR host3.my.domain.com.
- x=5; for host in $(<hosts.txt); do echo -e "$((x+y))\t\tIN\t\tPTR\t\t$host."; echo $((y++)) >> /dev/null; done; y=0
- -----------------------------------------------------
- Generate new A-records from old ones, keeping CNAMEs
- -----------------------------------------------------
- # this creates something like:
- # host1 IN A 192.168.1.5
- # host2 IN A 192.168.1.6
- # host3 IN CNAME host2
- # host4 IN A 192.168.1.7
- awk 'BEGIN {count=5} {if ( $4 ~ /192.168/ ) { count++; print $1,"\t",$2,"\t",$3,"\t","192.168.10."count } else print $1,"\t",$2,"\t",$3,"\t",$4;}' dns_A_records.orig
- ---------------------------------------------
- Generate new DHCP entries from the old ones
- ---------------------------------------------
- # this will grab whole {blocks} of DHCP entries
- for host in $(<hosts.txt); do awk "/$host/,/}/" /etc/dhcpd/vlan130.conf; done >> vlan150.conf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement