Welcome to WebmasterWorld Guest from 18.104.22.168
Safe from what?
DDOS? Blacklisting by spam monitors? Bad neighborhood issues?
The only "safe" approach to IP addressing that I can conceive of is to have lots of them on different blocks, but if you're geotargeting that could be a problem in some cases.
Plus there's all the other factors that SEs look at, like WhoIs info (or absence thereof), creation dates, same registar for domains of X date, interlinking, . . . down to rat-out reports from competitors in your favorite SERPs.
I've heard that if i put a site A on the IP which is used for ns1.maindomain.com then going to ns1.maindomain.com would show that site A too.
Can this hurt site A? Can this trigger some duplicate content penalty?
"Host headers" is a topic you might explore if it's an IIS server.
As to duplicate penalties few can say exactly how a specific outcome will be processed, even with a lot more detail than you should care to post here (forgetting for the moment that it's against the TOS and Charter).