Monday, November 2, 2015

linux - How can I override TTL of an Internet Address?



I'm running a caching DNS server currently to improve latency in a network.



The question is: can I override the TTL I get from a server using BIND9 or other software on Linux?



short "dig www.google.com" here:




; <<>> DiG 9.6.1-P2 <<>> www.google.com



;; ANSWER SECTION:
www.google.com. 604441 IN CNAME www.l.google.com.
www.l.google.com. 300 IN A 74.125.45.147



Can I change that '300' into 15 minutes?



Thanks you so much for your time!!.


Answer




the DIRTIEST most ugliest thing that can be done is...



1-Downloading the source
2-find the file called cache.c
3-find the function is_expired



4- Change it in this way



static int is_expired(time_t now, struct crec *crecp)
{

if (crecp->flags & F_IMMORTAL)
return 0;

if (difftime(now, crecp->ttd) < 0)
return 0;

return 0; // IT WAS IN ONE
}



When the function ask did expire? we always saw no



In this way it will never expire and you will conquer the world.



OUTPUT:



; <<>> DiG 9.6.1-P2 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28477

;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com. IN A

;; ANSWER SECTION:
www.google.com. 603937 IN CNAME www.l.google.com.
www.l.google.com. 4294966733 IN A 209.85.195.99
www.l.google.com. 4294966733 IN A 209.85.195.104
www.l.google.com. 4294966733 IN A 209.85.195.147


;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Feb 17 18:34:47 2010
;; MSG SIZE rcvd: 110

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...