Electronic and ionic transport in carbon nanotubes and other nanostructures