18

From my understanding, ARP translates an IP address into a MAC address, and then the computer uses the MAC address to establish a direct connection.

If I already know the MAC address of the computer I want to connect to, is it possible to directly connect to it (without a router)? Is there an example of this?

1
  • Sure. But, even without a router, you can assign IP addresses on each machine individually and use IP protocols between them -- either using a hub or a direct connection.
    – svidgen
    Feb 8, 2016 at 5:17

3 Answers 3

14

If I already know the MAC address of the computer I want to connect to, is it possible to directly connect to it? Is there an example of this?

You can connect at a low level and send packets to other machines on the same local network, but it'd be difficult to know what to put in those packets without knowing more about the protocols in upper layers.

For example, there are network protocols other than IP that work over ethernet, and the drivers that implement these protocols do exactly what you describe -- they connect at a low level without knowing an IP address (because there is no IP address to know) and transfer data.

That said, MAC addresses don't mean much outside the bounds of the local area network, so you need higher level protocols and routers that understand them in order to communicate with machines on other networks.

6
  • 1
    Thanks. How exactly does the network interface know how to connect to the other interface? Do interfaces send out beacon frames like wireless routers do?
    – Colin
    Feb 8, 2016 at 1:18
  • 1
    It doesn't know. That's basically how ethernet works. When one node on the network has something to say, it listens first to see if anyone else is sending something, and if not it just puts the message out there on the network for anyone to hear. If some other node starts at exactly the same time, they both detect the collision, stop talking, wait a bit, and try again.
    – Caleb
    Feb 8, 2016 at 1:20
  • 1
    @Colin: On the MAC level, a network interface can only connect to interfaces in the same (sub-)network. To communicate with machines outside the local network, routers are used to transfer packets from one network to another and to reach the destination, multiple routers can sit between you and the remote machine. Feb 8, 2016 at 7:46
  • 1
    Right. So how is a (sub)-network created or defined? Do all the computers have to connect to the same hub/switch/router? Or is there a way to create a network without them?
    – Colin
    Feb 8, 2016 at 8:21
  • @Colin Depends on the physical layer -- sometimes all the machines are connected to a single hub, as in 10baseT and similar; sometimes they're all connected to the same physical wire, as in 10base2, a.k.a. "thin-net", sometimes they're not connected at all but all talk to the same hub, as in WiFi. But there are lots of different network technologies and the details vary from one to the next, so although ethernet is a good model to have in your head, don't imagine that it's the only way to do things.
    – Caleb
    Feb 8, 2016 at 9:01
3

Sort of.

IP addressing is at some level symbolic, usually relying on lower-level network protocols (with less hierarchic structure) to actually complete the transmission.

On the IP level, each machine has (at least) one IP, in (at least) one subnet. It may also (and usually does) have a "default gateway" (that is, an IP address through which it sends all packets going to somewhere other than a local subnet).

Abstractly, a packet destined for a web port looks something like:

[ethernet header][ip header][tcp header][payload]

The ethernet header contains various control information, including the source and destination MAC addresses on the LAN.

The IP header contains various control information, like source and destination IP and the encapsulated protocol (TCP, in this example).

The TCP header contains various control information, various flags (what part of the session is this, what's the sequence number, source and destination TCP ports, ...)

The payload is merely transmitted by TCP and "only the application cares".

ARP is used when someone on the local network wants to send an IP packet, to an IP it doesn't have a MAC address for and is basically an ethernet-level broadcast saying "who has IP address blah?".

Most machines won't have anything listening for pure-ethernet connections, but you may still be able to map that MAC to an IP address. In a non-switched LAN, you simply need to observe the packets, find something with a source or destination MAC that is the one you want to talk to and parse the IP out.

If the machine has an ethernet level listener of some sort, you could talk to that, but you won't be able to talk to that from outside the local LAN, as the ethernet frames destined for the machine won't be picked up on the other side of the local router.

1

This post is rather old, but I don't feel that it got the correct answer.

IF you can connect to the device you know the MAC of on the same network (ideally a cross-over cable). You can assign an IP address to the MAC and then access the IP that way:

Microsoft Windows Windows systems require the dash "-" character between each digit of the MAC Address (Ethernet Address).

arp -s 192.168.1.2 00-80-77-31-01-07
ping 192.168.1.2

UNIX/Linux UNIX and Linux systems require the colon ":" character between each digit of the MAC Address (Ethernet Address).

arp -s 192.168.1.2 00:80:77:31:01:07
ping 192.168.1.2

For this to work though, you must be on the same Ethernet segment (that is, there cannot be a router between you and the device you're trying to connect with).

1
  • Seems interesting, but I get: cannot intuit interface index and type for 192.168.1.2
    – Vladtn
    Feb 14, 2023 at 21:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.