Forum Discussion
F5 DNS - iRule to rewrite NAPTR response
when DNS_REQUEST priority 500 {
if { ([string tolower [DNS::question type]] eq "naptr") and ([DNS::question name] eq "test.apn")} {
DNS::answer clear
set new_rr1 {test.apn. 1800 IN NAPTR 10 60 "a" "x-test-pgw:x-s5-gtp:x-gn" "" topoff.pgw-s5s8.pgw-PM-01.node.epc.mnc033.mcc222.test.org.}
set new_rr2 {test.apn. 1800 IN NAPTR 10 40 "a" "x-test-pgw:x-s5-gtp:x-gn" "" topoff.pgw-s5s8.pgw-PM-02.node.epc.mnc033.mcc222.test.org.}
set new_rr_1 [DNS::rr $new_rr1]
set new_rr_2 [DNS::rr $new_rr2]
DNS::answer insert $new_rr_1
DNS::answer insert $new_rr_2
DNS::header rd 0
DNS::return
}
}
[root@NF42GTT1-A3:Active:Standalone] config # dig @172.16.53.53 test.apn naptr
; <<>> DiG 9.11.31 <<>> @172.16.53.53 test.apn naptr
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38382
;; flags: qr ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;test.apn. IN NAPTR
;; ANSWER SECTION:
test.apn. 1800 IN NAPTR 10 60 "a" "x-test-pgw:x-s5-gtp:x-gn" "" topoff.pgw-s5s8.pgw-PM-01.node.epc.mnc033.mcc222.test.org.
test.apn. 1800 IN NAPTR 10 40 "a" "x-test-pgw:x-s5-gtp:x-gn" "" topoff.pgw-s5s8.pgw-PM-02.node.epc.mnc033.mcc222.test.org.
;; Query time: 2 msec
;; SERVER: 172.16.53.53#53(172.16.53.53)
;; WHEN: Thu Sep 28 19:24:21 CST 2023
;; MSG SIZE rcvd: 243
- Gerald_MeeseSep 28, 2023Cirrus
Many many thanks !! Will give it a try in the coming days ! Take care 🙂
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com