Click to See Complete Forum and Search --> : Can subnets and gateways be calculated?
v333k
May 25th, 2010, 12:17 PM
Hi,
I am writing a program on Linux that requires to to setup itself with a static IP provided by a user but the gateway and subnet mask are not. Is there a way to calculate them? If not, what do you recommend as a solution, where the least preference is to ask the user to enter them.
Thanks in advance.
MrViggy
May 26th, 2010, 12:20 PM
Well, not the gateway. The gateway IP address can be any valid address on the network. The subnet masks, on the other hand, do have default values. However, I don't know what they are, off the top of my head.
Viggy
v333k
May 26th, 2010, 12:26 PM
thanks MrViggy.
I did more research and I found out some of the things you mentioned.
3 classes with each class having its own unique set of subnets. I had to look into subnets and get a good understanding but I think I have a solution...
Class A, subnets 255.0.0.0 up to 255.255.255.224 (depending on the bit masks and # of bits)
Class B, subnets 255.255.0.0 up to 255.255.255.252 (depending on the bit masks and # of bits)
Class C, subnets 255.255.255.0 up to 255.255.255.252 (depending on the bit masks and # of bits)
MrViggy
May 27th, 2010, 04:40 PM
Yup, that's it. The "default" subnet is usually the first set you mention (by that, I mean the ones with '0's).
Viggy
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.