You are on page 1of 18

Departament d'Enginyeria Telemtica

IP Exercises

Chapter 1
IP
Exercises
Exercise 1 -1

The Intranet shown in the gure is based on IP to interconnect dierent Ethernet networks.

Internet

147.83.39.1/30

147.83.1.0/28
ServerFarm
Network
W

H1

147.83.39.2/30
eth2

147.83.1.1/28
eth0

R1

147.83.1.6/28
eth0

eth1

eth0
147.83.1.13/28 DB

SW1

eth1

H2

Intranet
Backbone
Network
eth1

R2

eth0

Intranet

eth0

R3

eth0

...

MarketingNetwork
#hosts=100

... H3

EngineeringNetwork
#hosts=50

The Intranet belongs to a company that has two servers: a WEB server (

DB).

eth0

W)

and a database server

These servers are placed in a network called Server Farm Network, which is constructed with an

H1).

Ethernet HUB of 10 Mbps (

In addition, the company has two other networks: one for the Marketing

department and another one for the Engineering department.


departments are interconnected with two hubs (

H2

and

H3)

As shown in the gure, the hosts of these


of 10 Mbps. Finally, the three networks are

interconnected with a network called Intranet Backbone Network. In this case, the network is constructed
with a full-duplex switch of 100 Mbps (

SW1).

The range 147.83.1.0/24 is available for addressing the entire Intranet. The
connects the Intranet to the Internet is congured with 147.83.39.2/30.

eth2

interface of

R1 that

The Marketing department has

100 employees and Engineering department has 50 employees. Each employee has a host with an Ethernet
3

network interface card (Ethernet NIC). For assigning the IP subnets, you must select always the largest
subnets possible.
1. Can you use FLSM? Why?

Do the subnetting for the Intranet with the appropriate technique and

explain how do you select a network address for each network. Write down also the broadcast address
for each network and the free addressing space that you do not need to use.
For populating the routing tables you must consider that the default routes route trac to the Internet,
that the number of entries must be as small as possible with routes of the minimal number of hops, that you
can use longest match and that the entries of the routing table have the following elds:

Consider also that the gateway of

Destination

GW

IF

X.X.X.X/mask

Y.Y.Y.Y

ethZ

R1's default route is 147.83.39.1.

2. Choose IP addresses for each router's interface. To do so, use the lowest IP address in each subnet for
the interfaces of routers. For your conguration, describe the routing tables of

DB.

R1, R2 and R3 and

W needs to obtain data from the DB server to generate a web


W receives HTTP requests to download a WEB page (HTML document) at a rate of

On the other hand, for the WEB service,


page. Consider that

HT T P = 6 HT T P requests/second.

The HTTP request size can be considered negligible, while the HTTP

response (that includes the HTML document) occupies 30 maximum Ethernet frames. In addition,
to run a request/response protocol with the

DB

W needs

server to generate each HTTP response. The request of

this protocol uses 10 maximum Ethernet frames and the response uses 25 maximum Ethernet frames.
3. According to the previous data, calculate the rate of correct frames per second (S ) that

H1 must

transmit to make the WEB service work properly.


In the following gure we represent the transfer function for the hubs that has to considered for this
exercise. The hub creates a shared media and the transfer function represents S, which is the link utilization
for successful frames (frames without collision) versus U, which is the total link utilization (including
collisions).

Note. U in this context is also called G.


0.6
S
0.5
0.4
0.3
0.2
0.1
0
0.1

0.2

0.3

0.4

0.5
0.6
U (Utilization)

0.7

0.8

0.9

4. Using the previous calculation and taking into account that the IP header has 20 bytes, that the MTU
(Maximum Transmission Unit) for Ethernet is 1500 bytes and that the Ethernet header has 26 Bytes,

H1 and use this value to nd out the total link utilization U in H1.
Note. Consider that the ARP trac is negligible compared to other trac.
compute S for

5. Now, suppose that the DB server has a security weakness that allows a hacker to increase the mask
in one bit, i.e. to a /29. If a hacker performs this attack, describe in detail what would happen to the
IP packets traveling from

DB to W.

6. If the attack has occurred, recalculate S and U for

H1.

7. Give some possible way of protecting your WEB service against this attack by changing the place of
some element of the Intranet or by changing some conguration?

Note. You can assume that all the network interface cards (NICs) are able to negotiate
the link speed to 10 Mbps or 100 Mbps.
Exercise 1 -2

The conguration of an Intranet can be observed in the following gure:

Internet

147.83.74.1
147.83.74.2
eth1

147.83.0.0/24

router1

eth2
172.16.39.17

SW
172.16.39.18
eth2

SW

eth2 router3 eth1


172.16.39.19

147.83.1.0/24

...

router2

147.83.14.0/24

eth1
172.16.39.1

172.16.39.5
eth1

SW
172.16.39.2
eth1
routerA

eth2
147.83.15.102

16Addresses
NetA

routerD

eth2

128Addresses
NetD

172.16.39.4
eth1
eth2
172.16.39.3
eth1
eth2
routerB

routerC

64Addresses
NetC

32Addresses
NetB

Intranet

The intranet has two parts:

147.83.X.0/24 (X = 0 . . . 14). This part of the network is accessible via router3.


147.83.15.0/24. This block is used by networks A, B, C and D. These networks are accessible via
router2.
Internet is accessible via router1. For populating the routing tables you must consider that the default

routes route trac to the Internet, that the number of entries must be as small as possible with routes of
the minimal number of hops, that you can use longest match and that the entries of the routing table have
the following elds:
5

Destination

GW

IF

X.X.X.X/mask

Y.Y.Y.Y

ethZ

1. Make an address allocation for the networks A, B, C and D using 147.83.15.0/24.


For this allocation you should consider the following:

2.

You can use VLSM.


You should leave unallocated the address space that you do not need.

routerA must be assigned to the IP address 147.83.15.102.


Describe the routing tables of routerA and routerC considering that:
IP addresses assigned to NICs eth1 of router2, routerA, routerB, routerC and routerD
The NIC

eth2

of the

are respectively: 172.16.39.1, 172.16.39.2, 172.16.39.3, 172.16.39.4 and 172.16.39.5.

These addresses belong to the network 172.16.39.0/28.

router2 and router1 considering that:


The IP addresses assigned to eth2 of the routers router1, router2 and router3 are respectively:

3. You must describe the routing tables of

172.16.39.17, 172.16.39.18 and 172.16.39.19.

These addresses belong to the network 172.16.39.16/28.


The IP/Mask assigned to

eth1

on

router1 is 147.83.74.2/24.
router1 is 147.83.74.1.

The gateway for the default route of

4. Now let us consider that the network administrator wants to connect to

router2 to do some manage-

ment. If the administrator is in a host with IP address 147.83.15.103, do we need to do NAT (Network
Address Translation) in some router? If so, which one and why? Finally, if the administrator wants
to establish a connection with

router2 from her home (a machine in the Internet), do we need to do

NAT in some router? If so, which one and why?

Note. Recall that 172.16.0.0/16 is a range for private addressing.


Exercise 1 -3

The conguration of a given Intranet is shown in the following gure:

Internet

eth1
eth2

32
addresses
eth2

64
C
addresses

routerA

eth1

routerB

eth1

147.83.0.0/24

router1

eth2
eth1

eth2

router2

172.16.1.0/29

eth2 router3
eth1

eth2

routerC

eth1

eth1

routerD

eth2

128
D addresses

172.16.1.32/27

16
addresses

172.16.1.8/29

147.83.1.0/24

...

...
147.83.31.0/24

Intranet

The networks A, B, C and D will use the address block

147.83.65.0/24, which you will have to properly

divide for subnetting.


1. Using

147.83.65.0/24, make an address assignment for the networks A, B, C and D that you observe

in the gure. For this assignment, you should consider the following:

eth2

routerA must be assigned to the IP address 147.83.65.28.

The

You must leave unallocated the address space that you do not need.

of

For the next question consider the following:

The IP addresses assigned to the network interfaces of the routers are the following:

routerA
routerB
routerC
routerD

eth1
eth1
eth1
eth1

router1
router2
router2
router3

172.16.1.10
172.16.1.11
172.16.1.12
172.16.1.4

eth2
eth1
eth2
eth2

172.16.1.1
172.16.1.9
172.16.1.2
172.16.1.3

For populating the routing tables you must consider that the default routes route trac to the Internet,
that the number of entries must be as small as possible with routes of the minimal number of hops,
that you can use longest match and that the entries of the routing table have the following elds:

Destination

GW

IF

X.X.X.X/mask

Y.Y.Y.Y

ethZ

You must only congure the routes necessary to enable the trac between Intranet hosts
and between Intranet hosts and hosts in the Internet.
2. Under the previous assumptions, describe the routing tables of

Exercise 1 -4

routerA, routerD and router2.

The conguration of a given Intranet is shown in the following gure:

Internet

eth0

eth2

routerF

NetA
16Addresses

SW3

NetB
32Addresses

eth1
192.168.0.131

eth2
routerA

routerB eth2

eth2
routerC
eth1
192.168.0.132

SW1

192.168.0.130
eth2
eth1

eth1
192.168.0.129

routerD

eth2

Intranet
192.168.0.0/19

routerE

192.168.0.0/25

router1

192.168.1.0/24

routerX

192.168.X.0/24

eth2

SW2

...

...

192.168.31.0/24
eth2 router31
X=1,2,3,..,31

The networks of the Intranet must be addressed using the range 192.168.0.0/19. As you can observe the

eth1

cards of some routers must be congured as follows:


7

routerC
routerD
routerE
routerF
1. Considering

ALL

eth1
eth1
eth1
eth1

192.168.0.132
192.168.0.129
192.168.0.130
192.168.0.131

the networks present in the Intranet, you must assign the network addresses for

the networks A, B and you must also assign the IP addresses and Masks to the

eth2

cards of all the

routers in the Intranet.

2.

Note. You must use VLSM.


Describe the routing table of routerD. For populating the routing tables you must consider that the
default routes route trac to the Internet, that the number of entries must be as small as possible
with routes of the minimal number of hops, that you can use longest match and that the entries of
the routing table have the following elds:

Destination

GW

IF

X.X.X.X/mask

Y.Y.Y.Y

ethZ

3. Consider that all networks with clouds in the gure are completely lled of hosts. In this case, if
we want to allow to send and receive trac from the Internet to all the hosts (only hosts but not
routers) in the Intranet, in which router would you implement NAT? why? Explain how many public
addresses are required for NAT if we use stateless NAT (which assigns one public address to each
private address).

Exercise 1 -5

Consider the network topology shown in the following gure:


virt1

virt2

eth1
192.168.0.32
01:01
eth1
192.168.0.144
03:01

1
3

Switch
Ethernet

virt3

eth1
192.168.0.96
02:01

2
4

eth1
192.168.0.224
04:01

virt4

As you can observe, we have four machines connected with an Ethernet swith of 4 ports. You can also
observe the MAC addresses and IP addresses assigned to each interface.

Assuming that the network is

initially not congured and that we execute the following commands:

virt1
virt1
virt2
virt2
virt3
virt4

#
#
#
#
#
#

i f c o n f i g eth1 192.168.0.32/25
route add net 192.168.0.128/25 gw 192.168.0.96
i f c o n f i g eth1 192.168.0.96/24
echo 1 > /proc/sys/net/ipv4/conf/ a l l /forwarding
i f c o n f i g eth1 192.168.0.144/24
i f c o n f i g eth1 192.168.0.224/25

1. Explain in detail what would happen after executing the following

virt1

# ping c 1 192.168.0.144

ping

command:

In your explanation, detail the packets and frames that will be sent and what will happen in each
device (MAC tables of the switch, ARP caches, routing tables etc.)

Note. Assume ICMP redirects have been disabled.

2. Like in the previous question, explain in detail what would happen after executing the following
command:
8

ping

virt1

# ping c 1 192.168.0.224

Exercise 1 -6

The conguration of a given Intranet can be observed in the following gure:

Intranet

147.83.1.0/24

147.83.0.0/24

...

SW0

...

...

SW1

eth0
eth128
10.0.0.2/24

147.83.127.0/24

...

eth1
RA

SWA

eth128
10.0.0.3/24
eth0

eth127

Internet

eth0
10.0.0.1/24

RB

eth1

SW128

...
147.83.128.0/24

SW127

128 networks

SWB

R1

eth127

R2

...

128 networks
SW255

SW129

...

...

147.83.255.0/24

147.83.129.0/24

The Intranet has dierent Ethernet networks. The routers

RA and RB have a dierent network card

for each Ethernet network to which they are connected. These routers also use always the lowest IP address
in each 147.83.X.0/24 network to which they are connected. The hosts have only one Ethernet Card called

eth0.

1. Calculate how many hosts that use IP addresses of type 147.83.X.0/24 can be connected to the routers

RA and RB in this Intranet.

2. Assuming that the routing tables are correctly populated in the routers of the Intranet and that all
the caches are empty (ARP caches and MAC tables of switches), explain in detail what would happen
if we send a

ping from 147.83.129.7 (B) to 147.83.1.9 (A). In your explanation, detail the packets and

frames that will be sent and the state of the MAC tables of the switches and the ARP caches.
For the next question consider that the routers do not generate trac.

All the layer 2 networks are

Ethernet using full-duplex 100 Mbps switches. All the hosts send the same trac to the Internet. There
cannot be congestion (accumulation of packets) at any router and we want to use a 100% the link

R1-R2.

We consider only unicast IP trac to the Internet (not consider ARPs). Consider that the Ethernet frames
have 26 bytes of layer 2 overhead, that IP packets have 20 bytes of layer 3 overhead and that the payload
of the frames is used completely (remember that the MTU of Ethernet is 1500 bytes).

payload (user data) for calculating the goodput.

We utilize the IP

3. According to the previous considerations, calculate the maximum goodput that can be generated by
each host.
For the next question consider that the processing delay at the routers can be expressed as:

Tp = n Tentry + 0.1ms
Where

n is the number of entries of the routing table and Tentry

is a per entry processing delay. The routers

have routing tables such that all the networks and the Internet are accessible and such that these tables use
the minimum number of routes and hops. We keep using the assumption that there cannot be congestion
(accumulation of packets) in any router and that we want to use a 100% the link
9

R1-R2.

4. Calculate

and the maximum

Tentry

at the routers

RA and RB.

RA, RB and the IP network 10.0.0.0/24 and that we connect


SW0, SW1,... SW255 directly to the switch SWA. Which conguration changes should we make to

5. Now, let's consider that we remove

obtain the most ecient conguration possible? Can we increase the number of hosts with addresses
147.83.X.0/24?
Following the above conguration and considering that:

R1 we also use the equation Tp = n Tentry + 0.1ms.

For the router

We keep using the assumption that there cannot be congestion in any router.

6. Compute the maximum

Tentry

for

R1.

For the next question consider that we execute a

echo-request

ping

with 3000 bytes of ICMP user data for one

message sent from 147.83.39.56 to an Internet IP address.

the routers. All the IP packets of the ICMP message are sent with ag
destination in order. In the

We allow fragmentation in all

DF = 0.

The fragments reach the

R1-R2 link, the MTU is reduced from 1500 bytes to 820 bytes.

R2 and the Internet has an MTU=620 bytes.

The link between

The rest of the links of Internet have a higher MTU.

7. Calculate the Fragment Oset (FO) of the second and third fragments that will arrive to the destination
node.

10

Chapter 1: Solutions
Solution Exercise 1 -1
1. With FLSM we cannot do it. Marketing needs 7 bits for the hostID (/25). With a xed /25 we can
only implement the addressing for two networks but we need addressing 4 networks. We have to do it with
VLSM.

25

26

27

28

29

30

31

32

Net

SF

Free

In decimal:

Network Name

Network Address

SF

147.83.1.0/28

Broadcast Address
147.83.1.15

147.83.1.128/25

147.83.1.255

147.83.1.64/26

147.83.1.127

147.83.1.32/27

147.83.1.63

Free

147.83.1.16/28

147.83.1.31

2. IP assignment:

R1: eth0:
R2: eth0:
R3: eht0:

eth1: 147.83.1.33/27; eth2:


eth1: 147.83.1.34/27.
147.83.1.65/26; eth1:147.83.1.35/27.
147.83.1.1/28;

147.83.39.2/24.

147.83.1.129/25;

Routing Table of

Routing Table of

Routing Table of

R1:

Destination

GW

IF

147.83.1.0/28

0.0.0.0

eth0

147.83.1.32/27

0.0.0.0

eth1

147.83.39.0/30

0.0.0.0

eth2

147.83.1.128/25

147.83.1.34

eth1

147.83.1.64/26

147.83.1.35

eth1

0.0.0.0/0

147.83.39.1

eth2

R2:
Destination

GW

IF

147.83.1.128/25

0.0.0.0

eth0

147.83.1.32/27

0.0.0.0

eth1

147.83.1.64/26

147.83.1.35

eth1

0.0.0.0/0

147.83.1.33

eth1

Destination

GW

IF

147.83.1.64/26

0.0.0.0

eth0

147.83.1.32/27

0.0.0.0

eth1

147.83.1.128/25

147.83.1.34

eth1

0.0.0.0/0

147.83.1.33

eth1

R3:

11

Routing Table of

DB:
Destination

GW

IF

147.83.1.0/28

0.0.0.0

eth0

0.0.0.0/0

147.83.1.1

eth0

3. The number of frames per request that need to be transmitted in

H1 is 30 (HTTP response) + 10

(request to DB) + 25 (response from DB). Thus,

S = 6 (30 + 10 + 25) = 390 frames/second


4. Then,

S = S 1526 8/10 Mbps = 0.476


Looking at the transfer function we get that
5. With a /29 in

U = 0.6

(60%)

DB, the trac from DB to W is not direct anymore. DB sends this trac via R1.

In other words, 147.83.1.13 is not in the direct network of 147.83.1.6/29.


6.

In this case, the number of frames per request that need to be transmitted in

H1

is 30 (HTTP

response) + 10 (request to DB) + 25 (response DB-R1)+ 25 (response R1-W). Thus,

S = 6 (30 + 10 + 25 + 25) 1526 8/10 Mbps = 0.659


U =1
That is to say,

H1 is using the 100% of shared channel without being able to transmit the number of frames

required by the WEB service.


7. One solution is to put

SW1 in the position of H1 and vice versa.

This is possible because the Ethernet

cards can negotiate the speeds 10/100. Another solution is to change the IP address of
the /29 network of

DB. E.g.

W to an address in

147.83.1.5.

Solution Exercise 1 -2
1. We must design subnetting for nets A, B, C and D using 147.83.15.0/24 (256 addresses).

28-bit mask.
27-bit mask.
Net C requires 64 addresses 26-bit mask.
Net D requires 128 addresses 25-bit mask.
An important fact to realize is that eth2 of routerA must use the address 147.83.15.102 or more precisely
Net A requires 16 addresses
Net B requires 32 addresses

147.83.15.102/28. Notice that the network address for network A can be calculated making a logic and
(&) between the address and the mask:

IPN et A = 147.83.15.102&255.255.255.240 = 147.83.15.96


Thus, network A has the address 147.83.15.96/28 (which goes from 147.83.15.96 to 147.83.15.111).
Now, we assign the address for the network that needs the larger number of addresses. This is network
D, which needs 128 addresses. Since addresses of Net A have the 25th bit set to zero, we have to use the
addresses with the 25th bit set to one (128 to 255) for the D network. Thus, network D has the address
147.83.25.128/25 (which goes from 147.83.15.128 to 192.35.15.255).
Our currently unassigned blocks are on one hand a block of 16 addresses (from 147.83.15.112 to 147.83.15.127).
And on the other hand, a block of 96 addresses (from 147.83.15.0 to 147.83.15.95). Notice that in this latter
range, we can allocate the networks B and C, which need 32 and 64 addresses respectively.
We begin with the largest network of these two (network C). For this network we need 6 bits for addressing
hosts and 2 bits to identify the network. In the range 147.83.15.0 to 147.83.15.95, the rst two bits of the
last byte are equal in the addresses 0 to 63 (in binary: 00000000-00111111) forming a block of 64 addresses.
This block is assigned to the network C: 147.83.15.0/26 (which goes from 147.83.15.0 to 147.83.15.63).
Finally, we assign 147.83.15.64/27 to network B (which goes from 147.83.15.64 to 147.83.15.63.95).
12

147.83.15.0

147.83.15.128
NetC
64addresses
147.83.15.0/26

147.83.15.63
147.83.15.64

147.83.15.95
147.83.15.96
147.83.15.111

NetD
128addresses
147.83.15.128/25

NetB
32addresses
147.83.15.64/27
NetA
16addresses
147.83.15.96/28
16addresses
147.83.15.255

2. Routing table of

routerA:
Destination

Routing table of

GW

147.83.15.96/28

0.0.0.0

eth2

172.16.39.0/28

0.0.0.0

eth1

147.83.15.0/26

172.16.39.4

eth1

147.83.15.64/27

172.16.39.3

eth1

147.83.15.128/25

172.16.39.5

eth1

0.0.0.0/0

172.16.39.1

eth1

routerC:
Destination

GW
0.0.0.0

172.16.39.0/28

0.0.0.0

eth1

172.16.39.2

eth1

eth2

147.83.15.64/27

172.16.39.3

eth1

147.83.15.128/25

172.16.39.5

eth1

0.0.0.0/0

172.16.39.1

eth1

router2:
Destination

Routing table of

IF

147.83.15.0/26
147.83.15.96/28

3. Routing table of

IF

GW

IF

172.16.39.16/28

0.0.0.0

eth2

172.16.39.0/28

0.0.0.0

eth1

147.83.15.0/26

172.16.39.4

eth1

147.83.15.64/27

172.16.39.3

eth1

147.83.15.96/28

172.16.39.2

eth1

147.83.15.128/25

172.16.39.5

eth1

147.83.0.0/20

172.16.39.19

eth2

0.0.0.0/0

172.16.39.17

eth2

router1:
Destination

GW

147.83.74.0/24
172.16.39.16/28

IF

0.0.0.0

eth1

0.0.0.0

eth2

147.83.15.0/24

172.16.39.18

eth2

147.83.0.0/20

172.16.39.19

eth2

147.83.74.1

eth1

0.0.0.0/0

13

4. If the administrator accesses

router2 from 147.83.15.103 we will not need NAT. This is because packets
router2) will travel only inside our Intranet, which is

from 147.83.15.103 to 172.16.39.1 or 172.16.39.18 (

managed by us. In this Intranet we can use a mix of private and public addresses provided that we properly
route each range.
However, if the administrator tries to access
scenario.

router2

from the Internet, this is a completely dierent

In this latter case, our packets need to travel through the public network.

Remember that we

cannot use private addresses in IP packets that cross Internet and thus, we need to do NAT. The right place
to do NAT is the

router1,

which connects the Intranet to the Internet.

eth1

static NAT that redirects the IP address 147.83.74.3 on the


the

router2).

of the

As an example, we could do a

router1 to 172.16.39.18 (eth2 of

Solution Exercise 1 -3
1. Address assignment:
147.83.65.28 (network A) = 10010011.01010011.01000001. 00011100

2. Routing table of

network address

mask

broadcast address

Subnet A

147.83.65.16

/28

147.83.65.31

Subnet B

147.83.65.32

/27

147.83.65.63

Subnet C

147.83.65.64

/26

147.83.65.127

Subnet D

147.83.65.128

/25

147.83.65.255

routerA:
Destination

GW

172.16.1.8/29

eth1

147.83.65.16/28

0.0.0.0

eth2

147.83.65.32/27

172.16.1.11

eth1

147.83.65.64/26

172.16.1.12

eth1

172.16.1.9

eth1

0.0.0.0/0
Routing table of

routerD:
Destination

GW

172.16.1.0/29

0.0.0.0

147.83.65.128/25

Routing table of

IF

0.0.0.0

IF
eth1

0.0.0.0

eth2

147.83.65.0/24

172.16.1.2

eth1

147.83.0.0/19

172.16.1.3

eth1

0.0.0.0/0

172.16.1.1

eth1

router2:
Destination

GW

172.16.1.0/29

0.0.0.0

172.16.1.8/29

IF
eth2

0.0.0.0

eth1

147.83.65.16/28

172.16.1.10

eth1

147.83.65.32/27

172.16.1.11

eth1

147.83.65.64/26

172.16.1.12

eth1

147.83.65.128/25

172.16.1.4

eth2

147.83.0.0/19

172.16.1.3

eth2

0.0.0.0/0

172.16.1.1

eth2

Solution Exercise 1 -4
1. Address assignment. The networks that have been already allocated in the Intranet are:
14

19

20

21

22

23

24

25

26

27

28

29

30

31

32

Net

1.0/24 (256@)

X.0/24 (256@)

31.0/24 (256@)

0.0/25 (128@)

SW1, we have the following addresses:

In the network of

192.168.0.129: 11000000.10101000.00000000. 10000001


192.168.0.130: 11000000.10101000.00000000. 10000001
192.168.0.131: 11000000.10101000.00000000. 10000001
192.168.0.132: 11000000.10101000.00000000. 10000001
For this network of 4 devices we need 3 bits. Thus, this network is 192.168.0.128/29.

19

20

21

22

23

24

25

26

27

28

29

30

31

32

Net

0.128/29 (SW1 - 8@)

SW2 and SW3.


SW3 has 3 devices, i.e.

Additionally, we have four more networks: A, B and the networks of

of

SW2 has 32 devices,

i.e. 6 bits for the HostID. The network of

The network
3 bits for the

HostID. Therefore:

19

20

21

22

23

24

25

If we assign

26

27

28

30

31

32

Net
/28 (Net A -16@)

/27 (Net B -32@)

/26 (SW2 - 64@)


/29 (SW3- 8@)

SW2, then Net B, then Net A and nally SW3 we obtain:

19

20

21

22

23

24

25

26

27

28

29

30

31

32

Net

0.144/28 (Net A -16@)

0
1

0
0
1
0

2. The routing table of

0.160/27 (Net B -32@)

0.192/26 (SW2 - 64@)


0.136/29 (SW3- 8@)

routerD is:
Destination

GW

192.168.0.0/25
192.168.0.128/29

3.

29

We should do NAT in

IF

0.0.0.0

eth2

0.0.0.0

eth1

192.168.0.0/19

192.168.0.130

eth1

192.168.0.128/26

192.168.0.132

eth1

0.0.0.0/0

192.168.0.131

eth1

routerF

because this router is the one that interconnects the Intranet to the

Internet. In other words, all the IP packets that want go to the Internet

must cross this router.

Regarding

the number of public IP addresses, we have 31 networks with 253 hosts. Net A has 13 hosts, Net B has 29
hosts and 192.168.0.0/25 has 125 hosts. Thus, this number is:

#P U BLIC@IP = 31 253 + 13 + 29 + 125 = 8010

Solution Exercise 1 -5
1. For the rst

ping:
15

virt1:~# ping -c 1 192.168.0.144


PING 192.168.0.144 (192.168.0.144) 56(84) bytes of data.
64 bytes from 192.168.0.144: icmp_seq=1 ttl=64 time=50.0 ms
--- 192.168.0.144 ping statistics --1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 50.086/50.086/50.086/0.000 ms
It works and the captured trac is:

No.
1
2
3
4
5
6
7
8
9

Time
0.000000
0.000117
0.000188
0.013092
0.013163
0.013228
0.025434
0.025505
0.025563

Source
fe:fd:00:00:01:01
fe:fd:00:00:02:01
192.168.0.32
fe:fd:00:00:02:01
fe:fd:00:00:03:01
192.168.0.32
fe:fd:00:00:03:01
fe:fd:00:00:01:01
192.168.0.144

Destination
Broadcast
fe:fd:00:00:01:01
192.168.0.144
Broadcast
fe:fd:00:00:02:01
192.168.0.144
Broadcast
fe:fd:00:00:03:01
192.168.0.32

Protocol
ARP
ARP
ICMP
ARP
ARP
ICMP
ARP
ARP
ICMP

Length
42
42
98
42
42
98
42
42
98

Info
Who has 192.168.0.96? Tell 192.168.0.32
192.168.0.96 is at fe:fd:00:00:02:01
Echo (ping) request id=0x8f04, seq=1/256, ttl=64
Who has 192.168.0.144? Tell 192.168.0.96
192.168.0.144 is at fe:fd:00:00:03:01
Echo (ping) request id=0x8f04, seq=1/256, ttl=63
Who has 192.168.0.32? Tell 192.168.0.144
192.168.0.32 is at fe:fd:00:00:01:01
Echo (ping) reply
id=0x8f04, seq=1/256, ttl=64

virt1:~# arp -n
Address
192.168.0.144
192.168.0.96

HWtype
ether
ether

HWaddress
FE:FD:00:00:03:01
FE:FD:00:00:02:01

Flags Mask
C
C

Iface
eth1
eth1

virt2:~# arp -n
Address
192.168.0.144

HWtype
ether

HWaddress
FE:FD:00:00:03:01

Flags Mask
C

Iface
eth1

virt3:~# arp -n
Address
192.168.0.32

HWtype
ether

HWaddress
FE:FD:00:00:01:01

Flags Mask
C

Iface
eth1

virt1:~# route -n
Kernel IP routing table
Destination
Gateway
192.168.0.0
0.0.0.0
192.168.0.128
192.168.0.96

Genmask
Flags Metric Ref
255.255.255.128 U
0
0
255.255.255.128 UG
0
0

Use Iface
0 eth1
0 eth1

virt2:~# route -n
Kernel IP routing table
Destination
Gateway
192.168.0.0
0.0.0.0

Genmask
255.255.255.0

Flags Metric Ref


U
0
0

Use Iface
0 eth1

virt3:~# route -n
Kernel IP routing table
Destination
Gateway
192.168.0.0
0.0.0.0

Genmask
255.255.255.0

Flags Metric Ref


U
0
0

Use Iface
0 eth1

According to the routing tables:

The

echo-request

The

echo-replay

goes from

goes from

virt1 to virt2 and from virt2 to virt3.

virt3 to virt1 directly.

The caches are also populated according to these routing paths. For example,

virt1 has two IP addresses:

the ARP entry for 192.168.0.96 was populated when the

echo-request was transmitted and the ARP entry

for 192.168.0.144 was populated when the

was transmitted.

After this

ping,

echo-replay

the switch has the following content:

2. For the second

Port

MAC

01:01

02:01

03:01

ping:
16

virt1:~# ping -c 1 192.168.0.224


PING 192.168.0.224 (192.168.0.224) 56(84) bytes of data.
--- 192.168.0.224 ping statistics --1 packets transmitted, 0 received, 100% packet loss, time 0ms
No.
1
2
3
4
5
6

Time
0.000000
0.000109
0.000172
0.020316
0.021275
0.021345

Source
fe:fd:00:00:01:01
fe:fd:00:00:02:01
192.168.0.32
fe:fd:00:00:02:01
fe:fd:00:00:04:01
192.168.0.32

virt4:~# route -n
Kernel IP routing table
Destination
Gateway
192.168.0.128
0.0.0.0
virt4:~# arp -n
Address
192.168.0.96
In this case, the

Destination
Broadcast
fe:fd:00:00:01:01
192.168.0.224
Broadcast
fe:fd:00:00:02:01
192.168.0.224

Protocol
ARP
ARP
ICMP
ARP
ARP
ICMP

Genmask
Flags Metric Ref
255.255.255.128 U
0
0
HWtype
ether

HWaddress
FE:FD:00:00:02:01

echo-request

arrives to

Flags Mask
C

virt4

Length
42
42
98
42
42
98

Info
Who has 192.168.0.96? Tell 192.168.0.32
192.168.0.96 is at fe:fd:00:00:02:01
Echo (ping) request id=0xa404, seq=1/256, ttl=64
Who has 192.168.0.224? Tell 192.168.0.96
192.168.0.224 is at fe:fd:00:00:04:01
Echo (ping) request id=0xa404, seq=1/256, ttl=63

Use Iface
0 eth1
Iface
eth1

but this host is not able to respond because it has not a

route to the source address (192.168.0.32).


However, the switch will have all the MAC addresses mapped.

Solution Exercise 1 -6
1.

256 253 = 64768

hosts.

B) to 147.83.1.9 (A) the messages will be the following:


- ARP broadcast with Eth-SRC=MAC-B.eth0 and Eth-DST=FF:FF:FF:FF:FF:FF in SW129 asking

2. For a

ping

from 147.83.129.7 (

for the MAC address of 147.83.129.1. This frame is transmitted broadcast by the switch (through all
the ports of the switch).
- ARP response with Eth-SRC=MAC-

RB.eth1 and Eth-DST=MAC-B.eth0.

This frame is transmit-

ted unicast by the switch (goes only between the two ports involved).

SW129 maps the MACs of B.eth0 and RB.eth1.


B and RB have also the MAC of each other (interfaces connected to SW129).

- During the ARP


- ARP caches of
-

B sends the ICMP echo-request message encapsulated in an IP packet with IP-SRC=147.83.129.7

and IP-DST=147.83.1.9, which is in turn encapsulated in an Ethernet frame with Eth-SRC=MAC-

B.eth0 and Eth-DST=MAC-RB.eth1. This frame is transmitted unicast by the switch.


- RB receives the frame and decapsulates the IP packet. Then, it analyses its routing

table and

discovers that the next hop is 10.0.0.2.

RB.eth128 and Eth-DST=FF:FF:FF:FF:FF:FF in SWA ask-

- ARP broadcast with Eth-SRC=MAC-

ing for the MAC address of 10.0.0.2. This frame is transmitted broadcast by the switch.

RA.eth128

- ARP response with Eth-SRC=MAC-

RB.eth128.

and Eth-DST=MAC-

This frame is

transmitted unicast by the switch.

SWA maps the MACs of RB.eth128 and RA.eth128.


RB and RA have also the MAC of each other (interfaces connected to SWA).

- During the ARP


- ARP caches of
-

RB

decrements the TTL, recalculates the IP header checksum and sends the IP packet (with IP-

SRC=147.83.129.7 and IP-DST=147.83.1.9) encapsulated in an Ethernet frame with Eth-SRC=MAC-

RB.eth128 and Eth-DST=MAC-RA.eth128. This frame is transmitted unicast by the switch.


- RA receives the frame and decapsulates the IP packet. Then, it analyses its routing table
discovers that the next hop is 147.83.1.9.
17

and

- ARP broadcast with Eth-SRC=MAC-

RA.eth1 and Eth-DST=FF:FF:FF:FF:FF:FF in SW1 asking

for the MAC address of 147.83.1.9. This frame is transmitted broadcast by the switch.

A.eth0 and Eth-DST=MAC-RA.eth1.

- ARP response with Eth-SRC=MAC-

This frame is transmit-

ted unicast by the switch.

SW1 maps the MACs of RA.eth1 and A.eth0.


RA and A have also the MAC of each other (interfaces connected to SW1).

- During the ARP


- ARP caches of
-

RA

decrements the TTL, recalculates the IP header checksum and sends IP packet (with IP-

SRC=147.83.129.7 and IP-DST=147.83.1.9) encapsulated in an Ethernet frame with Eth-SRC=MAC-

RA.eth1 and Eth-DST=MAC-A.eth0.


- Likewise, the response, the

This frame is transmitted unicast by the switch.

echo-replay

message is encapsulated in an IP packet that just follows

the reverse path. However, in this case, we do not need to run the ARP protocol again and since the
switches have also learned the MACs involved, we avoid further broadcast of any type.
3.

100 Mbps
64768

= 1544 bps

Goodput->

1480
= 1544 bps 1526
= 1497.4 bps

4. Let's consider

15268 bits
50 Mbps

RA (the computation for RB is identical).

= 0.24416 ms = Tp

n = 131
Networks (147.83.0.0/24 to 147.83.127.0/24) + 1 (10.0.0.0/24) + 1 (147.83.128.0/17) + 1 (default to

R1)= 131 entries in the routing table.


Tentry = 1.1 s

5. We have to change the IP masks to /16 because we now are in a single L2 network. Now, we can have

216 2 1 64768 = 765


6. In

additional hosts.

R1 we need n = 3 entries (147.83.0.0/16, an entry for the network with R2 and the default route

to Internet).

R1 receives IP packets at 100 Mbps and must forward them also at 100 Mbps.
Then,

15268 bits
100 Mbps

= Tp = 0.12208 ms

Tentry = 7.36 s
7.

F O2 = 600/8 = 75

and

F O3 = 800/8 = 100.

18