S
S
Stanislav Timoshko2020-08-26 15:13:01
linux
Stanislav Timoshko, 2020-08-26 15:13:01

What is the gateway address for?

I don’t understand why, when setting up a node on a local network, you need to specify the gateway address if all nodes on the network are already connected to it. Isn't the node's task to spit out a data packet from the source and destination IPs over the cable, and the gateway router itself will decide what to do with this packet:
If the recipient's IP is present on the local network, then send the packet to the port to which the target node is connected
If The recipient IP is not in the local network, then in the packet, change the source IP from gray to white and send it on a journey through the global network.

And the only purpose of the gateway in my misunderstanding is the use of static routes when you need to organize communication between two subnets of the same local network

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Andrew, 2020-08-26
@deepblack

and the gateway-router itself will decide what to do with this packet:

For this, you need a router (router), also known as a gateway.
Even a LAN can be subnetted.
I recommend reading:
Olifer Computer networks. Principles, technologies, protocols.
After reading, many points will become more understandable.

K
Karpion, 2020-08-27
@Karpion

To send a packet out - it must be forwarded to the router.
If the network is built on switches, then you need to shove the IP packet into an Ethernet frame, where the MAC address of the default_gateway (or another gateway, there are different configurations) will be specified as the destignstion.
If the network is built on hubs or coaxial, then it is also necessary. But I'm too lazy to explain, because it's irrelevant. For those who are interested, it is enough to know that the promiscuity on the network card is turned on only when absolutely necessary.
How can our computer find out the MAC address of the gateway? This can be learned through the ARP protocol; but for an ARP request, you need to know the IP address of the requested computer. Actually, here is the answer:
We prescribe the gateway address so that our computer can find out the MAC address of the gateway with an ARP request.
By the way, there is an alternative configuration option: the computer knows its IP address, the mask is 0.0.0.0, and ARP correspondence is prescribed for all external computers. Such a solution is suitable for a computer that never calls outside itself, but only receives calls from outside. And in general, this is some kind of perversion; though it might work.

S
Stalker_RED, 2020-08-26
@Stalker_RED

There can be multiple gateways in a network.
And yes, the gateway can not only spit out something there, it can work according to much more complex rules. Filter, shape, authenticate, and more.
And yes, the network can be divided into segments.

N
Nikita Shinkevich, 2020-08-26
@domres

...another use of the gateway, for example, is access to the extranet, if it exists ... that is, NAT. And also access to the addresses of another LAN, if for example it is a VPN - VPN bridge ... uuuu ... a gateway is needed for a lot of things ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question