Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Difference between Mac and IP addresses Post 302541869 by pludi on Tuesday 26th of July 2011 04:39:14 AM
Old 07-26-2011
The MAC address is used every time you send a packet, and there's no case where just the IP is used. Most traffic you'll see is either using TCP or UDP packets for transport. These are encapsulated in IP packets, which are in turn (on a regular ethernet or WiFI network) encapsulated in Ethernet frames. TCP and UDP know nothing about the network structure, and don't really care, because that's the job of IP. IP in turn doesn't know anything about the data it's transmitting, but only cares about getting it through the network. And Ethernet only cares about getting it through the wire to the next local point without colliding with another frame.

How do these parts play together? Lets say you want to establish a TCP connection between 2 hosts:
-Host AHost B
HostnameHothDagobah
MAC Address00-11-22-33-44-55-66-77-8801-23-45-67-89-ab-cd-ef
IP Address10.1.2.5/16192.168.5.99/24
Gateway10.1.255.254192.168.5.1
I'm assuming here that both hosts already know the IP of the other (either by a static entry or through DNS).

A data packet from Hoth to Dagobah can't be sent directly, since they're on different subnets, so it has to go through the gateway. But IP doesn't allow for multiple destination addresses. If the packet is sent with the gateway IP as destination, it won't be sent out on the other network. And we can't get the MAC address of the other host, since that information isn't routed to us. The solution is that the packet is sent with the IP address of Dagobah, but with the MAC address of the gateway. That way the routing gateway has to look at the packet (it was directed there), sees that the real destination is on the other network, and sends it there.
This User Gave Thanks to pludi For This Post:
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Any difference between the CLI of Mac OS X and normal UNIX?

Any? (11 Replies)
Discussion started by: edward
11 Replies

2. UNIX for Dummies Questions & Answers

Mac addresses of NICs (why are they the same)

I am training to be support on our solaris based network and was wondering why solaris seems to assign the same mac address to all NICs placed in the machine regardless of how many NICs are in there, when i do a ifconfig -a all nics have same MAC. Presumably this is a feature and there is... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

3. UNIX for Dummies Questions & Answers

Help extracting MAC addresses from List

Hello all. I have a large number of text files outputted from various Netstumbler Wireless Scans; from which I need to extract the MAC addresses of the various Access Points. The Text files look like this: # $Creator: Network Stumbler Version 0.4.0 # $Format: wi-scan summary with... (9 Replies)
Discussion started by: dhs23
9 Replies

4. Shell Programming and Scripting

Need help with IP and MAC addresses

Hi, i am working on a project where i have to write a script to find out MAC addresses of the systems with given IP address. Can anybody tell me which command i can use to find MAC address if you know IP address of the machine. Thanks (5 Replies)
Discussion started by: manmeet
5 Replies

5. Shell Programming and Scripting

Don't see my mac addresses of my devices

I have a problem with a script , i want to see my devices there are up in my network. I want as output the ip addresses of the devices and also the mac address but I only had the ip addresses #!/bin/bash while ] do -mac) Extension=5 shift mac=$1 shift ;; esac... (1 Reply)
Discussion started by: Roggy
1 Replies

6. Shell Programming and Scripting

Script getting IP's and MAC addresses

Hy over there, Lets make it simple :) Using a bash script, how to grep only the ip address and the mac address and put them in a file:. for example from the dhcp.conf file we got such things: The script will end up with two columns IP's and MAC adresses as it is showed below: ... (9 Replies)
Discussion started by: hermouche
9 Replies

7. Shell Programming and Scripting

awk to calculate difference of split and sum the difference

In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13. I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 Replies
All times are GMT -4. The time now is 02:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy