Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I know this topic has a lot information all over but I can't find an answer to a simple question.
I am willing to have a subnet for each availability zone in my region (3 zones). My VPC CIDR is 10.0.0.0/19 and I want each subnet to have same amount of IPs. My question is what is the CIDR Block I should assign for each subnet?
10.0.0.0/19 has 8,192 IP addresses, from 10.0.0.0 through 10.0.31.255
When dividing up a supernet into subnets of equal size, you can only divide by powers of two -- 2, 4, 8, 16, etc., so this block can't be divided into 3 blocks of equal size, but it can be divided into 4.
10.0.0.0/21 has 2,048 addresses
10.0.8.0/21 has 2,048 addresses
10.0.16.0/21 has 2,048 addresses
10.0.24.0/21 has 2,048 addresses
Since you only three of these, you could simply reserve one of them for use in a 4th availability zone if you are given access to one (some accounts do have access to more than 3 availability zones in at least one region) or for other purposes.
However, even though you may not realize it yet, you probably need at least two subnets in each availability zone in each VPC. Typically, your instances go on private subnets, but NAT Gateways or Instances and Elastic Load Balancers need to be in public subnets. See Why do we need private subnets in VPC? for more detail on how this works.
So, you probably need at least 6 blocks. Again, you can't make 6 even-sized blocks, but you can make 8, and stash the two leftovers away.
10.0.0.0/22 has 1,024 addresses
10.0.4.0/22 has 1,024 addresses
10.0.8.0/22 has 1,024 addresses
10.0.12.0/22 has 1,024 addresses
10.0.16.0/22 has 1,024 addresses
10.0.20.0/22 has 1,024 addresses
10.0.24.0/22 has 1,024 addresses
10.0.28.0/22 has 1,024 addresses
Another important factor in VPC is that you do not need to worry about the subnet a machine is on if it is communicating with another machine in the same availability zone. There is no difference in performance within an availability zone whether the two communicating instances are on the same subnets or not... so it may make sense to use even smaller subnets that these, or variable length subnet masks, and segregate your machines for administrative convenience.
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 months ago.
Improve this question
A company is granted a static address 192.168.10.0.
The Company wants to have four subnets for four of its departments. Each Department is having 50-60 computers.
Design Subnetwork using sub netting concepts.
Identify Number of IP addresses on required in each Subnetwork.
Write their starting and ending addresses.
I am not getting, how to approach this problem.
Thanks in Advance
The company is granted a static address of 192.168.10.0. The company wants to have four subnets for four of its departments. Each department is having 50-60 computers.
To design the subnetwork, we will use the subnetting concepts. The company has been granted a static address of 192.168.10.0. This is a Class C IP address. The first octet (192) is the network address and the last three octets (168.10.0) are the host addresses.
To create four subnets, we will need to borrow two bits from the host addresses. This will give us four subnets, each with 62 host addresses. The first subnet will have the network address of 192.168.10.0 and the last subnet will have the network address of 192.168.10.192.
The first subnet will have the starting address of 192.168.10.1 and the ending address of 192.168.10.62.
The second subnet will have the starting address of 192.168.10.65 and the ending address of 192.168.10.126.
The third subnet will have the starting address of 192.168.10.129 and the ending address of 192.168.10.190.
The fourth subnet will have the starting address of 192.168.10.193 and the ending address of 192.168.10.254.
I was reading about IP and how it actually saves 2 datas: Network and Host.
But there are few things which aren't that clear to me.
What is an example of network? Is each home with its own router considered one network? Or one of those large companies like ATT, Orange etc...
What is an example of Host? How is Host different when compared to network? Is every device under same router considered a Host?
Does the split (of host and network) hold true too for local devices under same router.
If 2 octals are for network then we can only have 2^16 networks in the world which doesn't make sense.
Please Help me understand by answering them all by order.
I think perhaps your source of information is not reliable, or you may have misinterpreted some of it. An IP address (in version IPv4, which is still dominant even today) is 32 bits, or 4 "octets" in length. Those 32 bits uniquely identify a single network interface on a single computer. Some number of the upper bits are used to identify what network the computer is on, and the rest to identify the specific machine on that network. How many bits are used to identify the network will vary. Note that, since 32 bits have not been really sufficient for the past 25(?) years, several schemes have been devised to re-use certain address ranges. My personal computer, for instance, is in the range 192.168.x.x, behind a normal consumer-grade router. Other tricks exist.
The best book on IP networking I have found is "TCP/IP Illustrated" by W. Richard Stevens, Addison-Wesley Publishing, ISBN 0-201-63346-9. Quite easy to read; just volume 1 will answer almost any question. Volume 2 is about implementation, while volume 3 is a bit "fluffy", and can be ignored.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
We have a computer that needs to communicate with two routers over one physical ethernet interface. I know this sounds weird, but each router is actually interfaced to an Iridium L Band receiver/transmitter, and we are hoping to double our bandwidth by using two.
I would like to be able to select which link to send data over at the application level, but I'm not quite sure how to do it. My first thought was to establish a virtual IP address in addition to the pre-configured static IP address and use two separate sockets to send() data out over each "interface" separately. My question is, how do I make it so that only one of the routers actually routes the data out to a remote host? The IP addresses and subnet masks of the Iridium transceivers are configurable. Is it possible to make one transceiver only listen to the data coming from one computer IP address? Subnets maybe?
Create vlan inter faces in your machine
ip link add link eth0 name eth0.1 type vlan id 10
ip link add link eth0 name eth0.2 type vlan id 20
assign ip address to eth0.1 and eth0.2 in two networks. Later you can choose which one to bind at application level.
say like this
ifconfig eth0.1 192.168.10.2/24 up
ifconfig eth0.2 192.168.20.2/24 up
Then configure your router in two networks rather than one. Your computer and the routers should be connected to trunk port in the switch. Configure your routers to be in two networks rather than same. Configure subinterfaces in routers so that they listen for vlan 10 and 20 respectively. (how exactly to do this depends on the type of router) I can give you commands only for cisco.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
whats the purpose of local IP addresses if there are mac addresses? ARP maps mac addresses to IP addresses but I don't see why it's needed, because I thought data on LANs are sent as frames which only care about the mac addresses.
Long ago and far away, there was more to the world than Ethernet LANs, and application writers didn't care whether your PC was attached to an Ethernet, a Token Ring, an XNS net, or dial-up. IP provides a layer of abstraction and coherence across the top of all those and many more, allowing application authors to ignore the differences between them.
And what happens if you want to talk to a macine that isn't on your local area network (such as StackOverflow).
IP allows routing of packets anywhere, not just locally in your current network segment and, though it's mostly over Ethernet now, IP can equally well work over other underlying layers, giving a consistent view to the upper layers. This is vital given how much stuff is actually built on IP (DNS, FTP, SSH, HTTP and so on).
Machines almost certainly will cache IP-to-ethernet details to speed up subsequent transfers so the impact of translation on the LAN isn't so bad.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I would like read netmask, network and broadcast address from an IP address. Basically I’m confused with netmask, CIDR, network and Broadcat terms, could anyone please help me to understand these terms.
Thanks,
Thomman
There is no intrinsic netmask, network and broadcast address for a given IP address. The three terms, combined with an IP address describe a network.
The (CIDR) netmask gives the number of bits that all IPs in the network share. For example, /15 means the first 15 bits are fixed. Because an IPv4 address has 32 bits, the next 32-15=17 bits are then variable. Since every number in an IPv4 address corresponds to 8 bits, that means the following addresses are in the network 1.2.0.0/15 (binary: 00000001.00000010.0.0/15):
1.2.0.1
1.2.0.2
1.2.0.255
1.2.1.2
1.2.255.255
1.3.1.1 # in binary: 00000001.00000011.0.0, i.e. the first 15 bits match
1.3.255.255
but not 1.4.1.1 (00000001.00000100.1.1) or 2.2.1.1 (00000010.10.1.1), since their first 15 bits differ from 00000001.0000001.
You can also express the netmask of a /x CIDR network in binary form by setting the first x bits. In our case, the first 15:
11111111.11111110.00000000.00000000 # binary
255. 254. 0. 0 # decimal
A network address is then the logical AND of any address in the network and the network mask, you set all the variable bits to zero. You can also think of it as the lowest address in the network. In our case: 1.2.0.0.
A broadcast address is the logical OR with the complement of the netmask. You set all the variable bits to one. You can also think of it as the highest address in the network. In our case: 1.3.255.255.
This terminology is equivalent for IPv6 addresses, although you'll usually specify only address and CIDR netmask. Also, a block between two colons now describes 16, not 8 bit. For example, 0001:0002:abcd::/48 contains 0001:0002:abcd::1 and 0001:0002:abcd:12::, but not 0001:0002:abce. You could express the netmask of this network as ffff:ffff:ffff:0 or even 1111111111111111:1111111111111111:1111111111111111::0, but /48 is shorter and easier to read. This network has 48 fixed and 128-48=80 variable bits.