0

I'm a beginner in networking and I'm looking for answers for these questions:

  1. Why do we have to connect through a default gateway when we are connected to a LAN and want to connect to another devices in the same network?
  2. Why is the destination MAC address in an ARP request all zeros? I thought it's a broadcast and it's supposed to be ff:ff:ff:ff:ff:ff.
2
  • 1
    What do you mean "pass by" a gateway?
    – Ron Trunk
    Aug 25, 2017 at 11:57
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Feb 19, 2018 at 17:47

3 Answers 3

3

Answer to first question:

In a LAN if the source and destination are part of the same subnet or broadcast domain then they do not need to pass through gateway. They can reach each other directly (typically in a bus topology). If any network device comes in between its a switch. A gateway comes into picture when you need to reach a host machine that is part of different LAN segment or both having different broadcast domain.

To determine whether two hosts are part of same network, two IP addresses are AND'd with a subnet mask if the result is the same then they are on the same network.

Answer to your second question:

The target mac address in the arp packet is by default set to zero and is ignored according to RFC 5227. The destination mac address in L2 header is correctly set to ff:ff:ff:ff:ff:ff for broadcast arp request.

2
  • For the question 1 .. I've found this explanation in a course in openclassrooms.com . so i wanderd why should we pass by a gw if we could directely connect to the specifique device. I don't know why they've wrote this if it's wrong.. But thnx for the clarification. Aug 25, 2017 at 12:47
  • 1
    It is definitely wrong if it says that. You can test. On your computer, you can statically set the IP address but leave the gateway empty. See if you can ping other computers on the same subnet
    – Fixitrod
    Aug 25, 2017 at 13:23
3

Assuming your are talking about a common TCP/IP over Ethernet network.

1 - this is not the case, if the destination is on the same network, the connection is made directly to the destinaiton without involving the gateway

2 - ARP is defined by RFC826 in which it is stated:

ar$tha: Hardware address of target of this packet (if known). [...]

If it does not (find the address in the cache) it generates an Ethernet packet with a type field of ether_type$ADDRESS_RESOLUTION. [...] It does not set ar$tha to anything in particular, because it is this value that it is trying to determine. It could set ar$tha to the broadcast address for the hardware (all ones in the case of the 10Mbit Ethernet) if that makes it convenient for some aspect of the implementation. It then causes this packet to be broadcast to all stations on the Ethernet cable originally determined by the routing mechanism.

Since the RFC doesn't specify the destination address, it's up to the implementation to set at whichever value. Some Operating Systems (Solaris I think) use all-zero while others use all-one (broadcast) address.

-1

When a device sends a network request, on the LAN (same subnet) and the L2 switch does not have an ARP for that host, it will send broadcast out all interfaces (minus the one traffic was received on) the .Pcap looks like "who is x.x.x.x tell x.x.x.x" the device with the associated MAC address will respond. The ARP is then saved in the MAC table of the L2 switch should additional traffic needs to return to that destination.

If you can imagine a hill, host are at the bottom and can only see each other, the gateway stands at the highest point and sees other gateways that are telling each other "hey I know this network x.x.x.x /24". Since the host don't know of other networks it sends to the gateway to forward.

1
  • Sorry but this is plain wrong. L2 switches don't do arp.
    – hertitu
    Aug 25, 2017 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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