Last year was largely marked by uncertainty and fear -- and also by significant inflows out of the stock market and into bonds. Skittish investors stuffed billions of dollars into fixed income mutual funds and ETFs in an attempt to escape the ongoing volatility. And while every investor, even those decades from retirement, can benefit from at least a minimal exposure to bonds, it's getting harder and harder to argue that fixed income isn't at the tail end of a spectacular bull run.

Interest rates are still hovering at historical lows, which means rates have nowhere to go but up, and bond prices have nowhere to go but down. And with signs that the economic recovery is finally gaining steam, interest rate hikes could come a lot sooner than anyone expects.

That means there's a lot of risk in the fixed-income sector these days. But for investors who want to protect their capital and dampen volatility within their portfolio, bonds are still the best option. Here are a few tips for investing in bonds in today's challenging market environment.

Cash-ing in
While bonds should be a primary feature in any retiree's portfolio, there's one adjustment you should make if you are retired or will be in the next few years -- keep a stash of cash to pay for near-term living expenses. Bonds tend to experience much less volatility than stocks, but they can still get hit with short-term losses from time to time.

So I believe that any money that you will need to access in the next five years should be kept in cash. A good money market account is a safe bet here. You won't be earning much, if anything at all, on this portion of your portfolio, but it will be immune from market movements, which is more important for your near-term needs.

On the short side
Duration is a measure of a bond or bond fund's sensitivity to a change in interest rates. Bonds with longer durations will be more strongly affected by changes in interest rates. So if you own a bond fund with a duration of five years, that means for every 1% that interest rates go up, your fund will fall in value by 5%. Short-term bonds and bond funds have much lower durations and are therefore more immune to changes in interest rates.

For example, the Vanguard Short-Term Bond ETF (NYSE: BSV) has a duration of just 2.7 years, which means it will fall about 2.7% for every percentage point that interest rates rise. On the other hand, the Vanguard Long-Term Bond ETF (NYSE: BLV) clocks in with a duration of 14.4 years. Clearly, the long-term-focused fund would be hit pretty hard by even a small rise in rates.

Now, if you're thinking that one obvious way to minimize interest rate risk is to plow all your assets into short-term bond funds, you're right -- but you probably don't want to do that. Because yields are so paltry, especially on the short end, loading up on short-term bonds means that you are effectively strangling the yield right out of your portfolio. That's the whole reason longer-term bonds offer higher yields -- to compensate you for the risk of tying your money up for longer periods of time. And since there's no telling exactly when rates will rise, you could miss out on a lot of money by sitting on the short end of the yield curve if rates continue to stay low.

So while you might want to shorten up your duration a bit by adding a short-term bond fund into the mix, you should also keep some exposure to higher-yielding intermediate-term bonds. For example, the Vanguard Total Bond Market ETF (NYSE: BND) has a duration of 5.0 years, while the Schwab U.S. Aggregate Bond ETF (NYSE: SCHZ) measures in with a 4.3-year duration. Either of these funds would make a good complement to a shorter-duration fund like the aforementioned Vanguard fund or the Schwab Short-Term U.S. Treasury ETF (NYSE: SCHO) with its 1.9-year duration.

Of course, if you don't want to dirty your hands with the whole concept of duration in the first place, you might want to consider investing in a first-rate actively managed bond fund like Dodge & Cox Income (DODIX). Here, an experienced team of fixed income investors will actively adjust duration as needed based on changing market conditions so you don't have to worry about it.

In it for the long haul
One last thing to remember is that even though bond investors are especially risk-averse and place a high value on avoiding losses, sticking to a long-term buy-and-hold bond strategy means that any near-term losses will eventually be more than offset by higher yields. While bond prices will fall in response to rising rates, investors or fund managers can now buy bonds with higher yields. In the span of just a few short years, that added yield will more than make up for the loss in price your bonds will experience. So by keeping your focus on the longer-run picture, you'll eventually end up ahead of the game -- but not if you try to cut your losses and hide out in cash in the meantime.

There's no telling when rates will finally start to head back up, but they will. If you're a bond investor, you shouldn't panic or dump your holdings in an attempt to time the market. Rather, with a few quick adjustments to your portfolio and a proper long-term mind set, you can safely ride out what promises to be a challenging few years for the fixed-income asset class.

Even though investors have rediscovered their love for bonds in recent years, odds are they won't provide the same level of returns going forward -- and that could put your retirement at risk. Our newest special free report highlights the shocking truth about your retirement. Don't miss this chance to grab your free copy of this can't miss report today!