Suppose I stay in the blue building and there is also a red building and other buildings too (picture below). In each building, there are about 50-60 families. An ISP provides internet connection in the locality and they have set up a gateway (made by allied telesis) in each building, and there are LAN ports (RJ-45) in every room. Building to building connection is made with fiber optic cable and from the gateway, they take cat6 cable to each room.
The ISP gives every user static private IP address for each connection and username-password to authenticate. eg: My IP is 172.30.138.84, subnet mask is 255.255.255.0 and default gateway is 172.30.138.1. Only after using these settings I can login with my username-password. Otherwise, I will get an error "you are not authorized to login from this IP".
Now suppose, I want to go to the red building (it has subnet mask 255.255.255.0 and default gateway 172.16.93.1, residents have IP addresses like 172.16.93.10,172.16.93.11 etc.). Now, I can't use my network settings. because this subnet is different. I can think of some configuration without changing my IP (I have to keep it same to authenticate).
ip: 172.30.138.84 subnet: 255.255.255.0 gateway: 172.30.138.1 ip: 172.30.138.84 subnet: 255.240.0.0 gateway: 172.30.138.1 ip: 172.30.138.84 subnet: 255.255.255.0 gateway: 172.16.93.1 ip: 172.30.138.84 subnet: 255.240.0.0 gateway: 172.16.93.1
But do they make any sense? As far as I think, they won't work.
So, Apert from calling my ISP and asking for a different IP suitable for that building (and associating my username with the new IP), is there any way I can use my old IP in the new subnet? Does this have to do something with static route? Or it needs to configure the gateway?
I am not actually going to the red building, but it came to my mind and I thought to learn something about these things. I read about subnetting, routes etc. whole day but as a new learner, I am facing problems understanding.
What will a gateway do if I use an IP outside of the defined subnet? will it discard my packets?