LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   simple networking question (https://www.linuxquestions.org/questions/linux-networking-3/simple-networking-question-4175542035/)

willc86 05-08-2015 09:40 PM

simple networking question
 
hello everyone, pretty sure this is a dumb question, but I was wondering if it is possible to find the gateway of a given ip?

lets say 131.22.111.111/22 (fake ip)

the reason i ask is i had to set up the printer at a room manually, and I had to add in the subnet mask and the gateway.

I pretty much went to a windows machine from my office to get the gateway and added that gateway address 131.22.1.64. lets say the office room had a subnet of 131.22.90.x

however, when i added it to the printer, turned out the gate way was different. turned out the gateway was 131.22.1.22
and lets say this room had a subnet of 131.22.80.x

what determines the gateway? if the network is 131.22.0.0/22, shouldnt it be same gateway no matter which room? why wouldnt the printer work with the gateway of the office?
(using fake ip addresses)

to add on, we are using a linux dns server

descendant_command 05-08-2015 09:56 PM

No.
The gateway is completely arbitrary and unrelated to network/netmask.
"Usually" (on soho router setups) it is a member of the subnet but that's not necessary.

shockingbehavur 05-09-2015 12:13 AM

simple networking question
 
for starters a print server will be needed use it that way the print server looks similar to an internet router/modem and the printer will get shared this way

MikeDeltaBrown 05-12-2015 07:38 PM

The only time a gateway is needed is for communication with hosts that are not on the local sub-net. As long as the IP address and netmask are correct, the printer should work with computers that are "local". If your office is part of a large company, you may have VLANs separating different business segments (ie. finance, HR, engineering, production). If this is the case then you would need the correct gateway address for computer outside your local subnet to work with your printer but computers inside your local subnet would work.

To clarify what decendant_command wrote, a gateway _does_ need to be on the subnet. Otherwise your computer (or printer) wouldn't know how to get to it. More technically, the gateway must be a member of the same broadcast domain as the hosts it services.

The gateway (address) is determined by the network administrator during design. Usually it is the lowest or highest address in the broadcast domain. For the case of 131.22.111.111/22:
Network address (unusable): 131.22.108.0
Possible Gateway addr (low): 131.22.108.1
Possible Gateway addr (hi): 131.22.111.254
Broadcast addr: 131.22.111.255

It looks to me that multiple broadcast domains are being used. Maybe you should talk to your network administrator.


All times are GMT -5. The time now is 01:25 AM.