The Media Access Control (MAC) address is the physical address of any device connected to a network. Every device has a unique MAC address. MAC addresses are used by end devices and switches to determine exactly where that device is located on the network. MAC addresses are 48 bits long and are written in hexadecimal notation (also called Hex). The first three sections of the MAC address normally are used to identify the manufacturer of the device. For example, 00:04:5A:xx:xx:xx is one of the MAC address prefixes used by Linksys / Cisco. Note that when I say network device I am not talking about the computer or end device itself. Instead, I am talking about the actual network device in the computer or end device. In other words, a laptop has a wireless network adapter and a wired network adapter. Both adapters will have a different MAC address, even though they are in the same laptop. Generally speaking, you can give your MAC address to anyone because, unless they are on the same physical network as you are, there is not going to be anything they can do with it.
An Internet Protocol (IP) address is either 32 bits or 128 bits long, depending on whether it is an IP version 4 (IPv4) or an IP version 6 (IPv6) address. IPv4 is slowly being phased out on the public Internet because we are running out of addresses. IPv6 is the next-generation replacement that offers billions more addresses. IPv4 is written in dotted decimal notation: 192.168.1.2. Each number between the periods represents 8 bits. 8 bits x 4 sections (called octets - think "oct" equals 8) equals 32 bits total. IPv6 is written in hex format, similar to how MAC addresses are written. A typical IPv6 IP address would be written as: FDB9:EBA8:8436:0389:1234:4321:ABCD:01AA.
IP addresses are used to identify the logical (not physical) location of your computer on a network. Every computer on a network must have a unique IP address. Multiple networks are identified by the network mask. The mask is what determines what part of an IP address is the network address, and what part of the address is the actual address for an end device on that network. IPv4 subnet masks are written the exact same way as IPv4 addresses are written. That is, in dotted decimal form. The subnet masks usually look something like this: 255.255.255.0.
To understand this, you have to look at it in binary form. Let's look at a computer that has an IP address of 192.168.1.2 with a subnet mask of 255.255.255.0. What network does this computer belong to? To find out, we compare the mask and the IP address in binary like so:
11000000 . 10101000 . 00000001 . 00000010 ==> 192.168.1.2
111111111 . 111111111 . 111111111 . 00000000 ==> 255.255.255.0
Looking at the binary above, anywhere where there is a '1' in the subnet mask means that the same bit in the IP address is part of the network address. Since the first three octets shown above are filled with 1's, we know that the network address for this computer is: 192.168.1.0
In order for this computer to be on the same network with any other computer, they must all have IP addresses that start with: 192.168.1 AND they must all use the subnet mask of: 255.255.255.0.
So, IP addresses are used to identify what network a computer belongs to, and where on that network that computer is logically located.
There are two types of IPv4 and IPv6 addresses: private and public. Public IP addresses are used on the Internet. Anyone can access these addresses. Private IP addresses are used by businesses and home users on their private networks. Private IP address are NOT accessible over the Internet. The three blocks of private IPv4 addresses are shown below:
10.0.0.0 through 10.255.255.255
172.16.0.0 through 172.31.255.255
192.168.0.0 through 192.168.255.255
We use Network Address Translation (NAT) to convert private addresses to public addresses for when we want to browse the Web or access public IP addresses from inside our private networks. I won't get into the details of NAT here. I will say that NAT only works one way. That is, NAT allows you to get out, but connections can not be initiated from the outside to come in without you manually setting up special configurations on your router. As such, NAT can be a powerful security barrier between you and the public Internet.
So, if I give you my private IP address, which is 172.16.0.100, there is nothing you will be able to do to attack me knowing that address - unless you somehow come to my house and get on my private network here. My public IP address, which is assigned to me by my Internet Service Provider (ISP) IS accessible by you. That is the address you do not want to share with anyone unless you trust them.