DNS problems to RoadRunner - tcp vs udp

I have seen intermittent problems on some client windows servers
sending to rr.com recently.

For example, the MX hosts for triad.rr.com are:

# dig -t mx triad.rr.com

;; QUESTION SECTION:
;triad.rr.com. IN MX

;; ANSWER SECTION:
triad.rr.com. 1609 IN MX 10 hrndva-smtpin01.mail.rr.com.
triad.rr.com. 1609 IN MX 20 hrndva-smtpin02.mail.rr.com.

The authoritative nameservers for mail.rr.com:

# dig -t ns mail.rr.com

;; QUESTION SECTION:
;mail.rr.com. IN NS

;; ANSWER SECTION:
mail.rr.com. 14204 IN NS cdptpa-admin02.mail.rr.com.
mail.rr.com. 14204 IN NS hrndva-admin01.mail.rr.com.
mail.rr.com. 14204 IN NS hrndva-admin02.mail.rr.com.
mail.rr.com. 14204 IN NS cdptpa-admin01.mail.rr.com.

All 4 of those queries will answer a UDP DNS query for host record
hrndva-smtpin01.mail.rr.com.

However, the hrndva-admin01.mail.rr.com and hrndva-admin02.mail.rr.com
servers do not respond to TCP queries at all. Example:

# dig hrndva-smtpin01.mail.rr.com @hrndva-admin01.mail.rr.com +tcp

; <<>> DiG 9.3.3rc2 <<>> hrndva-smtpin01.mail.rr.com
@hrndva-admin01.mail.rr.com +tcp
; (1 server found)
;; global options: printcmd
;; connection timed out; no servers could be reached

From what I have read, public DNS servers should support both UDP and

TCP queries. TCP queries are often used when a UDP query fails, or if
the answer is over a certain length.

Any clues would be appreciated.

Mark

Mark Price wrote:
<SNIP>

From what I have read, public DNS servers should support both UDP and

TCP queries. TCP queries are often used when a UDP query fails, or if
the answer is over a certain length.

UDP is used for queries.

TCP is used for zone transfers.

If my server responded to TCP queries from anyone other than a secondary
server, I would be VERY concerned.

Jon Kibler
- --
Jon R. Kibler
Chief Technical Officer
Advanced Systems Engineering Technology, Inc.
Charleston, SC USA
o: 843-849-8214
c: 843-224-2494
s: 843-564-4224

My PGP Fingerprint is:
BAA2 1F2C 5543 5D25 4636 A392 515C 5045 CF39 4253

It's also sometimes used if a reply doesn't fit in the 512 bytes for a
UDP answer and EDNS0 isn't in effect. You get a truncated UDP packet back
and re-ask the query over TCP.

Jon Kibler wrote:

UDP is used for queries.

TCP is used for zone transfers.

If my server responded to TCP queries from anyone other than a secondary
server, I would be VERY concerned.

That is a common, but incorrect, assumption.

DNS responses that are larger than the MTU of a single UDP packet are sent as TCP.

Back in the day (c. 1998) Microsoft had some arpa zones that they felt it necessary to create hundreds of PTRs per entry. Of course, they denied TCP to their nameservers. The end result is that our BIND8 server was crashing on the lookups (it was a crappy port to NT).

Jon Kibler wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Price wrote:
<SNIP>

>From what I have read, public DNS servers should support both UDP and
TCP queries. TCP queries are often used when a UDP query fails, or if
the answer is over a certain length.

UDP is used for queries.

TCP is used for zone transfers.

If my server responded to TCP queries from anyone other than a secondary
server, I would be VERY concerned.

I see long TXT records from some DNSBLs that won't fit in a UDP packet on a daily basis. Certainly nothing to be concerned about.

~Seth

Red alert:

[cookiemonster:~] owens% dig +tcp aset.com @209.190.93.130 soa

; <<>> DiG 9.4.2 <<>> +tcp aset.com @209.190.93.130 soa
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5864
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;aset.com. IN SOA

;; ANSWER SECTION:
aset.com. 14400 IN SOA ns1.sims.net. hostmaster.aset.com. 2006111001 10800 3600 3600000 86400

;; AUTHORITY SECTION:
aset.com. 14400 IN NS ns3.trustns.net.
aset.com. 14400 IN NS ns1.sims.net.
aset.com. 14400 IN NS ns1.trustns.net.
aset.com. 14400 IN NS ns2.sims.net.
aset.com. 14400 IN NS ns2.trustns.net.

;; ADDITIONAL SECTION:
ns1.sims.net. 86400 IN A 209.190.93.130
ns2.sims.net. 86400 IN A 209.190.93.132

;; Query time: 31 msec
;; SERVER: 209.190.93.130#53(209.190.93.130)
;; WHEN: Fri Jun 13 14:31:13 2008
;; MSG SIZE rcvd: 211

Bill.

Sorry to abuse the list, but aset.com seems to have some mail blocking
issues:

<Jon.Kibler@aset.com>
    (reason: 551 5.7.1 Message undeliverable. Please see: http://bounce.trustem.net/edu.php?id=m5DIJA6U012003.0.1… not accept email from DHCP connections with an academic institution supplied hostname (you.VT.EDU).)

Jon? It's not a DHCP connection. It's a dedicated fixed IP address that hasn't
moved in at least 6 years, it's in the DNS as such, and I'm curious what you
based the "it's a DHCP" on?

Incidentally, you may want to clean up your message, as the URL

http://bounce.trustem.net/edu.php?id=m5DIJA6U012003.0.1

is unclear as to whether it has 0, 1, 2, or 3 trailing dots, and whether any
trailing dots are an ellipsis rather than a part of the URL. Actually visiting
that with all of 0..3 dots *all* fail with a "Oops link not found" screen, so
it isn't like I can sort it out based on info your message provides.

Bill Owens wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Price wrote:
<SNIP>

>From what I have read, public DNS servers should support both UDP and
TCP queries. TCP queries are often used when a UDP query fails, or if
the answer is over a certain length.

UDP is used for queries.

TCP is used for zone transfers.

If my server responded to TCP queries from anyone other than a secondary
server, I would be VERY concerned.

Red alert:

[cookiemonster:~] owens% dig +tcp aset.com @209.190.93.130 soa

; <<>> DiG 9.4.2 <<>> +tcp aset.com @209.190.93.130 soa
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5864
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;aset.com. IN SOA

;; ANSWER SECTION:
aset.com. 14400 IN SOA ns1.sims.net. hostmaster.aset.com. 2006111001 10800 3600 3600000 86400

;; AUTHORITY SECTION:
aset.com. 14400 IN NS ns3.trustns.net.
aset.com. 14400 IN NS ns1.sims.net.
aset.com. 14400 IN NS ns1.trustns.net.
aset.com. 14400 IN NS ns2.sims.net.
aset.com. 14400 IN NS ns2.trustns.net.

;; ADDITIONAL SECTION:
ns1.sims.net. 86400 IN A 209.190.93.130
ns2.sims.net. 86400 IN A 209.190.93.132

;; Query time: 31 msec
;; SERVER: 209.190.93.130#53(209.190.93.130)
;; WHEN: Fri Jun 13 14:31:13 2008
;; MSG SIZE rcvd: 211

UGH. Apparently hosting provider must have messed with IPTABLES on that
system. Thanks for the heads up. (Open mouth, insert foot.)

Jon Kibler
- --
Jon R. Kibler
Chief Technical Officer
Advanced Systems Engineering Technology, Inc.
Charleston, SC USA
o: 843-849-8214
c: 843-224-2494
s: 843-564-4224

My PGP Fingerprint is:
BAA2 1F2C 5543 5D25 4636 A392 515C 5045 CF39 4253

True. But TCP can (and in some cases, has to be) used for queries also.
You are misinformed. See RFC 1035 (and others).

I wouldn't be unless it looked like a DDoS - and it might for some that
are seeing the results of a DNS-based DDoS mitigation device you or an
upstream put in for the first time. These boxes force clients to switch
over from UDP to TCP for queries when a well formed UDP DNS attack hits.

John

If my server responded to TCP queries from anyone other than a secondary
server, I would be VERY concerned.

you may want to read the specs

randy

Not to toss flammables onto the pyre.

BUT there is a large difference from what the RFC's allow and common practice. In our shop TCP is blocked to all but authoratative secondaries as TCP is sinply too easy to DoS a DNS server with. We simply don't need a few thousand drones clogging the TCP connection table all trying to do zone transfers ( yes it happened and logs show drones are still trying )

For a long time there has been a effective practice of

UDP == resolution requests
TCP == zone transfers

It would have been better if a separate port had been defined for zone transfers as that would obviate the need for a application layer gateway to allow TCP transfers so that zone transfers can be blocked and resolution requests allowed for now all TCP is blocked.

Now just because someone has a bright idea they drag out a 20 y/o RFC and say SEE, SEE you must allow this because the RFC says so all the while ignoring the 20 years of operational discipline
that RFC was written when the internet was like the quad at college everyone knew one and other and we were all working towards a common goal of interoperability and open systems , These days the net is more like a seedy waterfront after midnight where criminal gangs are waiting to ambush the unwary and consequently networks need to be operated from that standpoint.

At the University networking level it is extremely difficult as we need to maintain a open network as much as possible but protect our infrastructure services so that they have 5 nines of availability
back in the day a few small hosts would serve DNS nicely and we did not have people trying to take them down and/or infecting local hosts and attempting DHCP starvation attacks. And no we are not at the 5 nines level but we are working on it.

- Scott

Randy Bush wrote:

Scott McGrath wrote:
[..]

For a long time there has been a effective practice of

UDP == resolution requests
TCP == zone transfers

WRONG. TCP is there as a fallback when the answer of the question is too large. Zone transfer you can limit in your software. If you can't configure your dns servers properly then don't run DNS.
Also note that botnets have much more effective ways of taking you out.

And sometimes domains actually require TCP because there are too many records for a label eg http://stupid.domain.name/node/651
If you are thus blocking TCP for DNS resolution you suddenly where blocking google and thus for some people "The Internet".

Also see:
http://homepages.tesco.net/J.deBoynePollard/FGA/dns-edns0-and-firewalls.html

(Which was the second hit for google(EDNS0) after a link to RFC2671)

Greets,
  Jeroen

There is no call for insults on this list - Rather thought this list was about techincal discussions affecting all of us and keeping DNS alive for the majority of our customers certainly qualifies.

We/I am more than aware of the DNS mechanisms and WHY there are there trouble is NO DNS server can handle directed TCP attacks even the root servers crumbled under directed botnet activity and we have taken the decision to accept some collateral damage in order to keep services available. We are a well connected university network with multi-gigabit ingress and egress with 10G on Abilene so we try to protect the internet from attacks originating within our borders AND we really feel the full wrath of botnets as we do not have a relatively slow WAN link to buffer the effects.

Yes - we are blocking TCP too many problems with drone armies and we started about a year ago when our DNS servers became unresponsive for no apparent reason. Investigation showed TCP flows of hundreds of megabits/sec and connection table overflows from tens of thousands of bots all trying to simultaneously do zone transfers and failing tried active denial systems and shunning with limited effectiveness.

We are well aware of the host based mechanisms to control zone information, Trouble is with TCP if you can open the connection you can DoS so we don't allow the connection to be opened and this is enforced at the network level where we can drop at wire speed. Open to better ideas but if you look at the domain in my email address you will see we are a target for hostile activity just so someone can 'make their bones'.

Also recall we have a comittment to openess so we would like to make TCP services available but until we have effective DNS DoS mitigation which can work with 10Gb links It's not going to happen.

- Scott

Jeroen Massar wrote:

Scott McGrath wrote:

There is no call for insults on this list

Insults? Where? If you feel insulted by any of the comments made on this list by people, then you probably are indeed on the wrong list. But that is just me.

- Rather thought this list was about techincal discussions affecting all of us and keeping DNS alive for the majority of our customers certainly qualifies.

[..blabber about DNS attacks over TCP..]

If I where a botnet herder and I had to take out your site and I was going to pick TCP for some magical reason then I would not care about your DNS servers, I would just hit your webservers, hard. I mean just the 'index.html' (http://www.harvard.edu/) is 24Kb, that is excluding pictures and there is bound to be larger data there which you are going to send and the bots only have to say "ACK" to once in a while.

Multiply that by say a small botnet of 1M hosts, each just requests that 24Kb file. You will have a million flows and won't have any way to rate limit that or control it. Your link was already full trying to send it back to the clients and next to that your server was probably not able to process it in the first place. Simple, effective, nothing you can do about it, except get way and way more hardware.

If somebody wants to take you out, they will take you out. Just get one other box with 10GE (not too hard to do) or just get a million of them with a little bit of connectivity (which is quite easy apparently)...

We/I am more than aware of the DNS mechanisms and WHY there are there trouble is NO DNS server can handle directed TCP attacks even the root servers crumbled under directed botnet activity and we have taken the decision to accept some collateral damage in order to keep services available.

"The root servers crumbled" wow, I must have missed somebody taking out all the 13 separate and then individually anycasted root servers. Which btw only do UDP as currently '.' is still small enough.

$ dig @a.root-servers.net. . NS +tcp
[..]
;; Query time: 95 msec
;; SERVER: 2001:503:ba3e::2:30#53(2001:503:ba3e::2:30)
;; WHEN: Sat Jun 14 23:45:52 2008
;; MSG SIZE rcvd: 604

That is only 1 packet to 1 packet, still only 500 bytes. While your little webserver would generate 24kb for that same sequence.

   We are a well connected university network with multi-gigabit ingress and egress with 10G on Abilene so we try to
protect the internet from attacks originating within our borders AND we really feel the full wrath of botnets as we do not have a relatively slow WAN link to buffer the effects.

The whole point generally of botnets is just the Denial of Service (DoS), if that is because your link is full or the upstreams link is full or because the service can't service clients anymore.

But clearly, as you are blocking TCP-DNS you are DoSing yourself already, so the botherders win.

Also note that Abilene internally might be 10G and in quite some places even 40G, but you still have to hand it off to the rest of the world and those will count as those 'slow WAN' links that you think everybody else on this planet is behind. (Hint: 10GE is kinda the minimum for most reasonably sized ISP's)

Yes - we are blocking TCP too many problems with drone armies and we started about a year ago when our DNS servers became unresponsive for no apparent reason. Investigation showed TCP flows of hundreds of megabits/sec and connection table overflows from tens of thousands of bots all trying to simultaneously do zone transfers and failing tried active denial systems and shunning with limited effectiveness.

How is a failed AXFR going to generate a lot of traffic, unless they are repeating themselves over and over and over again? Thus effectively just packeting you?

Also, are you talking about Recursive or Authoritive DNS servers here?
Where those bots on your network, or where they remote?

We are well aware of the host based mechanisms to control zone information, Trouble is with TCP if you can open the connection you can DoS so we don't allow the connection to be opened and this is enforced at the network level where we can drop at wire speed.

Do you mean that the hosts which do TCP are allowed to do transfers or not? As in the latter case they can't generate big answers, they just get 1 packet back and then end then FIN.

Note also, that if they are simply trying to overload your hosts, UDP is much more effective in doing that already and you have that hole wide open apparently otherwise you wouldn't have DNS.

Open to better ideas but if you look at the domain in my email address you will see we are a target for hostile activity just so someone can 'make their bones'.

It probably has nothing to do with the domain name, it more likely has something to do with certain services that are available or provided on your network.

Also recall we have a comittment to openess so we would like to make TCP services available but until we have effective DNS DoS mitigation which can work with 10Gb links It's not going to happen.

You think that 10Gb is a 'fat link', amusing :wink:

There are various vendors, most likely also reading on this list, who can be more than helpful in providing you with all kinds of bad, but also a couple of good solutions to most networking issues that you are apparently having.

But the biggest issue you seem to have is not knowing what the DoS kiddies want to take out and why they want to take it out.

Greets,
  Jeroen

PS: You do know that an "NS" record is not allowed to point to a CNAME I hope? (NS3.harvard.edu CNAME ns3.br.harvard.edu. RFC1912 2.4 :wink:

I feel your pain, but I think there may be a slight mis-analysis of the
situation. However I may be mistaken, given the lack of details.

The 10Gb really doesn't have much to do with tcp-state-table problems.

Any network with a large user population probably should have separate
DNS servers for their authoritative zones answering the Internet at-large and their recursive resolvers serving their user population.

DNS recursive resolvers may not need to answer unsolicited queries from
the Internet at large. It may make sense to keep those servers behind
stateful packet gateways, and only allow both UDP and TCP responses from the Internet to UDP and TCP queries made by the local, authorized users.
Because you don't know what Answer all the other DNS servers may give,
including a Truncated answer, recursive resolvers must be able to use TCP
to send queries to the Internet at large, and receive TCP queries from
its local, authorized user population.

If your own local users are DOSing your own DNS recursive resolvers, hopefully that's your own problem.

A DNS authoritative server may only need to answer unsolicited UDP queries from the Internet at large. Because DNS clients (stub, resolvers) must send a query as UDP first, and may use TCP if the Answer has the truncated bit set, an authoritative name server which knows all its answers will always fit in the minimum DNS Answer and never sets the truncated bit shouldn't get a TCP DNS query. RFC1112 says DNS servers should answer unsolicited TCP DNS queries anyway, but its not a MUST and it may rate limit its TCP answers.

Given those constraints, it may make sense for DNS authoritative servers
to limit TCP, either with an ACL or rate-limit the TCP/SYNs. But its only a medium term solution. DNS answers are growing. Someday those DNS authoritative servers probaly will need to send a large DNS Answer. But that is under the control of the local DNS administrator. So hopefully he or she will know when the DNS server breaks, and will fix it then.

Also, modern TCP/IP stacks and modern name server implementations
don't have as many tcp-state-table issues as they did at the beginning
of the decade. Any DOS attack based on TCP would disrupt HTTP/Web
servers just as much as TCP/DNS servers. So many of the same mitigation
techniques (and attacks) for Web servers may be applicable to DNS servers.

So briefly

1. Separate your authoritative and recursive name servers
2. Recursive name servers should only get replies to their own DNS queries from the Internet, they can use both UDP and TCP
3. Recursive name servers should only get queries from their own user population, they can use both UDP and TCP
4. Authoritative servers may only need to answer UDP queries from the Internet, if they never truncates its Answers. But the DNS administrator should plan what to do when its Answers get too large.

Most DNS servers don't provide good alerts to DNS administrators doing stupid things, like sending big DNS answers while blocking TCP.

I tried to capture some of these ideas in some ACLs
<http://www.donelan.com/dnsacl.html>

Sean Donelan wrote:

1. Separate your authoritative and recursive name servers
2. Recursive name servers should only get replies to their own DNS queries from the Internet, they can use both UDP and TCP

We've just completed a project to separate our authoritative and recursive servers and I have a couple notes...

1) For the recursive-only, we're using a combination of BIND's "query-source address a.b.c.d" and "listen-on e.f.g.h" in the hopes of providing some additional measure of protection against cache poisoning. The "listen-on" IPs are ACL'd at the borders so non-clients cannot get ANY packets to them. The "query-source address" itself doesn't appear in the "listen-on" list either and won't respond to queries. I know this isn't foolproof, but it probably raises the bar slightly against off-net poisoning attempts.

2) The biggest drawback to separation after years of service is that customers have come to expect their DNS changes are propagated instantly when they are on-net. This turns out to be more of an annoyance to us than our customers, since our zone is probably the most frequently updated.

3) I've gone so far as to remove the root hint zone from our auth-only boxes, again out of paranoia ("recursion no" does the trick, this is just an extra bit of insurance against someone flipping that bit due to a lack of understanding of the architecture). There is one third party we have to use an 'also-notify' by IP address in this case for their zone.

Mike

If you're running bind for your recursive boxes, `rndc -s <server> flushname <zone>' run against each recursive box should do the trick for bind 9.3.0 upwards. It will flush the cache for that zone only. There was a bug where it wouldn't flush negative caches, but that might be fixed. YMMV, etc.

Usual common sense warnings apply.

There's really two problems here - one is packet/bit rate causing problems for your network, that's not necessarily an end system thing. Not really DNS specific, and blocking 53/TCP doesn't really help here as people could just send 53/UDP your way and get the same effect.

Connection table overflowing is a bit of a different issue, obvious way to overcome that is to whack a load balancer in there to share the load around. It's not immediately obvious to me why your connection table would be filling up - what state were connections stuck in?

Anyway, one thought that comes to me would be to split off UDP and TCP services to different servers - if some TCP attack kills your TCP DNS server you:
a) don't have to worry about UDP services failing.
b) can turn it off for the duration of the attack, and are no worse off than you are right now, then turn it back on when you see the high volume of SYN messages disappear.
c) as TCP DNS service recovery isn't super time critical (I'm assuming this, because you're not running it at all right now) you have time to look at the anatomy of the attack and figure out how to filter it more precisely if possible, instead of simply dropping all TCP.

Obviously, you'd want to make sure TCP from your other name servers always goes to the UDP one, etc. etc.

* Jon Kibler:

From what I have read, public DNS servers should support both UDP and

TCP queries. TCP queries are often used when a UDP query fails, or if
the answer is over a certain length.

UDP is used for queries.

TCP is used for zone transfers.

I've seen such claims countless times. 8-( However, you can perform
zone file transfers over UFP in some cases (using IXFR), and TCP
fallback may happen even if you never respond with packets with the TC
bit set.