The Dúnedain Rangers had been guarding the Shire for some time when the Nazgul came and entered the land of the Hobbits during their hunt for the Ring. How did the Nazgul get past the border patrols, or were the Rangers unaware of their presence in the Shire?
This is answered in the Tale of Years entry for 22nd September 3018 (Return of the King Appendix B):
The Black Riders reach Sarn Ford at evening; they drive off the guard of Rangers.
And for 23rd September 3018:
Four Riders enter the Shire before dawn. The others pursue the Rangers eastward, and then return to watch the Greenway.
There's more information on this in Unfinished Tales, The Hunt for the Ring, and I give the passage in full:
Night was waning on the twenty-second day of September when drawing together again they came to Sarn Ford and the southernmost borders of the Shire. They found them guarded for the Rangers barred their way. But this was a task beyond the power of the Dúnedain; and maybe it would still have proved so even if their captain, Aragorn, had been with them. But he was away to the north, upon the East Road near Bree; and the hearts even of the Dúnedain misgave them. Some fled northward, hoping to bear news to Aragorn, but they were pursued and slain or driven away into the wild. Some still dared to bar the ford, and held it while day lasted, but at night the Lord of Morgul swept them away, and the Black Riders passed into the Shire; and ere the cocks crowed in the small hours of the twenty-third day of September some were riding north through the land, even as Gandalf upon Shadowfax was riding over Rohan far behind.
So the Dunedain were there but had been driven away by five of the Nazgul in order to allow the other four to enter.