2

Theoretical question. Can every computer on the Internet be connected directly to router instead through switch?

This can be paraphrased as can we make a network setup where we replace all switches with routers (or NAT routers)?

I'm not sure but maybe this boils down to the why do we need MAC if we have IP asked already here: Why do we need MAC address? and here What is the exact use of a MAC address?.

Most of the answers do not satisfy me, like we need Layer 2 addressing, IP is layer 3..., or inter-operation of two protocols.

Let me explain couple of counterarguments:

  • If end device has a direct link to router it can give him the IP directly, no need to pre-communicate with MACs.

  • MACs are unique and can be blocked, but they can also be faked. I don't see other need for unique addressing.

  • Why map MAC with ports (links) when we can map IP with ports (links).

I'm motivated by our home networks where we don't really need switches instead we connect devices with NAT routers.

So without link layer switching and addressing it would go like this:

  • I connect to router with dedicated link (wireless or ethernet)
  • It gives IP address to that link
  • I continue communication with Internet hidden behind NAT communicating with my router on my dedicated link

Can you say what feature would we miss if we eliminate all the switches?

  • Is there some issue you're trying to solve, or are you looking for a wide-ranging discussion on the pros and cons of switched vs routed networks of the size of the entire internet? Right now this question really doesn't feel like the right sort of question for Superuser. – music2myear Nov 1 '17 at 21:19
  • I'm not solving practical problem. Want to understand why link level addressing. – croraf Nov 1 '17 at 21:20
  • You want to understand why link level addressing... what? – music2myear Nov 1 '17 at 21:21
  • why it exists.- – croraf Nov 1 '17 at 21:21
  • 1
    Oh, ok. "Why" questions need open discussion, a forum. Superuser is not about open discussion, but is about focused, specific questions and good solid answers. It's not that we don't want your questions here, it is that this is not the place you are likely to get the best answer to this sort of question, and this sort of question detracts from what this place is about. – music2myear Nov 1 '17 at 21:24
3

Can every computer on the Internet be connected directly to router instead through switch?

Yes.

I'm motivated by our home networks where we don't really need switches instead we connect devices with NAT routers.

You are talking about a home router with 4 LAN ports and 1 WAN port? Those 4 LAN ports are on a switch integrated in the home router.

The followup question is: If you can replace all switches by routers, why don't we do that?

Answer: Routers are much more expensive than switches, both in terms of hardware cost and in times of computing ressource needed to do the networking. So it would be wasteful.

And the internet isn't consisting only of home users behind ISPs. No sane computing center would throw out all switches and replaces them with routers, not if they want to keep making money.

  • Following discussion with Ron I just wanted to post that follow up. Do you read my mind. Yes that device superuser.com/questions/1264492/… – croraf Nov 1 '17 at 22:33
  • But they are less expensive and more performant than router+switch that we have in that home gateway device. – croraf Nov 1 '17 at 22:46
  • Actually in many home routers those 4 ports are actually individual ports which, with the right software (dd-wrt) can be isolated and handled as router ports. The default software actually bridges the ports together so it emulates and appears as a switch. – davidgo Nov 2 '17 at 1:10
  • @davidgo: All home routers I've seen so far use a switch for those. The OpenWRT wiki usually lists the chip that's used for the switch, e.g. TP-Link WR841ND. The switch supports VLAN, so you can isolate ports with VLAN tagging, but it's still a switch. If you happen to know a home router that really does use individual ports, I'd be very interested to know the brand and model. – dirkt Nov 2 '17 at 8:01
  • 1
    The question is perfectly sane, and I never said otherwise. But a switch has a much higher bandwidth at a fraction of the hardware (and electricity) cost. And that's the main reason computing centers uses switches. And that reason isn't particular intricate. What's intricate is some networking details when you switch between layer 3 routing and layer 2 switching, and I didn't want to go into these, but they don't really matter for the result. – dirkt Nov 2 '17 at 9:03
2

A router is also a host at layer-2. If the layer1/2 LAN is an IEEE LAN (ethernet, Wi-Fi, token ring, etc.), then it must communicate using a MAC address on the LAN. The IEEE LAN protocols use MAC addresses to communicate. A host directly connected to a router interface via ethernet (or other IEEE LAN) would still communicate by MAC address. If you connect with a different layer-1/2 protocol, e.g. to a serial interface via PPP, then you would not use a MAC address, but you will probably not get close to the speed of modern ethernet.

The point of the network layers is using encapsulation and abstraction. This leads you to being able to transport any layer-3 protocol (IPv4, IPX, IPv6, AppleTalk, etc.) on the layer-2 LAN, even simultaneously. You would not want to have to replace your LAN equipment (e.g. switches or WAPs) when adding or migrating to IPv6.

  • Why it needs an address to communicate when it has dedicated link? Either wireless channel or cable. – croraf Nov 1 '17 at 21:23
  • 1
    Because the IEEE LAN protocols are designed to be used on anything from a single link to a multiaccess network. The MAC is built into the standards. Using ethernet without MAC is not ethernet, but some other protocol. The ethernet frame header is mostly the source and destination MAC addresses. There is nothing in an IP header (either IPv4 or IPv6) to deal with the link. The encapsulation and abstraction lets you mix and match layer-1/2, layer-3, and layer-4 protocols. Any layer-2 protocol can carry any layer-3 protocol, and neither knows or cares what the other is. – Ron Maupin Nov 1 '17 at 21:27
  • 1
    I explained that PPP doesn't use MAC addresses. Neither do ATM, frame relay, etc. PPP only has two possible endpoints, so it doesn't use addressing. ATM uses VPI/VCI, and frame relay uses DLCI. Those are not normally considered LAN protocols, and they are usually used on WAN connections. – Ron Maupin Nov 1 '17 at 21:32
  • 1
    Some do. I explained that in my last comment: "PPP only has two possible endpoints, so it doesn't use addressing. ATM uses VPI/VCI, and frame relay uses DLCI." – Ron Maupin Nov 1 '17 at 21:34
  • 3
    My point is that removing the switches doesn't remove the need for the MAC addressing. It is the layer-2 protocol that dictates if you use MAC or not. The IEEE LAN protocols are designed around MAC. The abstraction lets you create different layer-3 protocols. The entire world doesn't actually revolve around IPv4, and IPv4 addressing has been exhausted. We are moving to IPv6, and the abstraction between layer-2 and layer-3 facilitates that. Ethernet existed long before bridges (from which switches were derived). – Ron Maupin Nov 1 '17 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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