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

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?

croraf

Posted 2017-11-01T21:03:52.123

Reputation: 135

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 – 2017-11-01T21:19:48.000

I'm not solving practical problem. Want to understand why link level addressing. – croraf – 2017-11-01T21:20:55.757

You want to understand why link level addressing... what? – music2myear – 2017-11-01T21:21:24.293

why it exists.- – croraf – 2017-11-01T21:21:58.577

1Oh, 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 – 2017-11-01T21:24:23.503

I partially agree. If I understand correctly from your comment, what I posted is a sane question for open discussion, and actually has a name "routed vs switched networks"? I thought I'm missing something basic and wanted the answers to point me that but seems the matter is a bit more delicate. Now I found more info here: https://serverfault.com/questions/222963/why-should-i-use-a-switched-network-over-routed?rq=1

– croraf – 2017-11-02T08:57:16.917

The bigger issue I see is that by including "the entire internet" as your focus you have made your question necessarily theoretical with no real way of making it practical without substantial change. If you could find a way to narrow the question so that it is more clear that you are asking for practical reasons to choose switched over routed networks, that would make more sense, but would still be borderline because the final decision and reasons come down to you personally and things we do not and cannot know about you. – music2myear – 2017-11-02T16:02:54.380

Answers

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.

dirkt

Posted 2017-11-01T21:03:52.123

Reputation: 11 627

Following discussion with Ron I just wanted to post that follow up. Do you read my mind. Yes that device https://superuser.com/questions/1264492/explaining-the-functions-of-cable-gateway-with-wirelessap-device/1264600#1264600

– croraf – 2017-11-01T22:33:24.817

But they are less expensive and more performant than router+switch that we have in that home gateway device. – croraf – 2017-11-01T22:46:21.267

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 – 2017-11-02T01:10:31.360

@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 – 2017-11-02T08:01:01.937

@Dirkt, yes, you are correct. – davidgo – 2017-11-02T08:19:48.123

I found the question I posted actually being very sane, as I thought I have some basic fault in my reasoning, but seems the answer is more delicate. More info: https://serverfault.com/questions/222963/why-should-i-use-a-switched-network-over-routed?rq=1. You can add this reference to your answer.

– croraf – 2017-11-02T08:52:28.540

1The 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 – 2017-11-02T09:03:04.937

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.

Ron Maupin

Posted 2017-11-01T21:03:52.123

Reputation: 3 130

Why it needs an address to communicate when it has dedicated link? Either wireless channel or cable. – croraf – 2017-11-01T21:23:01.030

1Because 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 – 2017-11-01T21:27:35.587

1I 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 – 2017-11-01T21:32:42.713

Do they use addressing at all? – croraf – 2017-11-01T21:33:29.123

1Some 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 – 2017-11-01T21:34:12.983

You actually moved the question to why we need MAC and gave actually good explanation with because we use ethernet. But I remembered now that the questions was would we lose something throwing away switches thus throwing MAC? :) And this is probably too broad. But you steered me in the right direction. – croraf – 2017-11-01T21:36:59.547

3My 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 – 2017-11-01T21:43:55.820

I understand that. You actually gave the best answer ever to why we need MAC: "Because we use IEEE LAN", and pointed me on what I should think about. BTW when I said "thus throwing MAC" I meant throwing the "need for MAC". – croraf – 2017-11-01T21:45:09.007