2

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".

image

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?

0

Your host will need to be addressed in the network where it is connected. It must have an IP address, mask, gateway, etc. for the network where it is connected, otherwise it will not be able to communicate with anything on the network, including the gateway for the network, so it will not be able to communicate with anything outside the network, either.

A host sending packets to another host will mask the source and destination addresses with the configured network mask. If they match, then the destination is on the same network, and the source host will send directly to the destination host on the LAN, otherwise, it will send to its configured gateway. That means that the gateway must be on the same network as the source host.

The problem you describe is exactly why we have DHCP. Hosts are usually configured for DHCP, and that will configure the host for the network to which it is connected.

| improve this answer | |
  • ip: 172.30.138.84 subnet: 255.240.0.0 gateway: 172.16.93.1 In this configuration, both my source machine and gateway are on the same network (red building). both source and gateway is connected by cat6. What will happen? I think my main confusion is, "What will a gateway do if I use an IP outside of the defined subnet? will it discard my packets?" – Sourav Ghosh Feb 23 '17 at 16:29
  • sorry. I edited my previous comment. I meant subnet: 255.240.0.0. now both are in 172.16.0.0/12 – Sourav Ghosh Feb 23 '17 at 16:35

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.