A DUF number is your registration number in the computer system of the Norwegian Directorate of Immigration (the UDI)
A national identity number is an ID number for you who have a residence permit and are going to live in Norway for more than six months.