35
Routing Recitation #3 COS 461: Computer Networks Spring 2013 1

Routing Recitation #3

  • Upload
    alayna

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

Routing Recitation #3. COS 461: Computer Networks Spring 2013. Outline. Fork() Wireshark Practice routing questions. Handle Multiple Clients using fork(). Steps to handle multiple clients Go to a loop and accept connections using accept() - PowerPoint PPT Presentation

Citation preview

Page 1: Routing Recitation #3

RoutingRecitation #3

COS 461: Computer NetworksSpring 2013

1

Page 2: Routing Recitation #3

Outline• Fork()

• Wireshark

• Practice routing questions

2

Page 3: Routing Recitation #3

Handle Multiple Clients using fork()

• Steps to handle multiple clients– Go to a loop and accept connections using accept()

– After a connection is established, call fork() to create a new child process to handle it

– Go back to listen for another socket in the parent process

– close() when you are done

3

Page 4: Routing Recitation #3

while (1) {

fd = accept (srv_fd, (struct sockaddr *) &caddr, &clen);

...

pid = fork(); children++;

/* child process to handle request */

if (pid == 0) {

/* exit(0) on success, exit(1) on error */

}

/* parent process */

else if (pid > 0) {

while ((waitpid(-1, &status, WNOHANG)) > 0)

children--;

if (children > MAX_PROCESSES)

...

}

else {

perror("ERROR on fork");

exit(1);

}}

4

Page 5: Routing Recitation #3

Wireshark• Selecting and listening on interface– Root for promiscuous mode: sniff on neighbors!

• Writing filters to select packets– “udp.dstport == 53”, “http.request_method is present”

• Examining packet formats– Look at Ethernet, IP, TCP, HTTP headers

• Following TCP streams– Trace HTTP request(s) belonging to a TCP connection

5

Page 6: Routing Recitation #3

Questions

6

Page 7: Routing Recitation #3

a

c

f

b

de b (a,?)

c (a,?)d (a,?)e (a,?)f (a,?)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 8: Routing Recitation #3

a

c

f

b

de b (a,b)

c (a,?)d (a,?)e (a,?)f (a,?)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 9: Routing Recitation #3

a

c

f

b

de b (a,b)

c (a,f)d (a,?)e (a,?)f (a,?)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 10: Routing Recitation #3

a

c

f

b

de b (a,b)

c (a,f)d (a,f)e (a,?)f (a,?)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 11: Routing Recitation #3

a

c

f

b

de b (a,b)

c (a,f)d (a,f)e (a,f)f (a,?)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 12: Routing Recitation #3

a

c

f

b

de b (a,b)

c (a,f)d (a,f)e (a,f)f (a,f)

linkdest

22

6

4

77

4

1810

Link State (Djikstra’s)

Page 13: Routing Recitation #3

Which routing protocol requires the least amount of state on the

router?a) link stateb) distance vectorc) path vector

13

Page 14: Routing Recitation #3

Which routing protocol requires the least amount of state on the

router?a) link stateb) distance vectorc) path vector

14

Page 15: Routing Recitation #3

Which of the following, if true, ensures packets from a to e always traverse c?

A. Y > 3

B. Y > X + 1

C. Y > X

D. A or B

Page 16: Routing Recitation #3

Which of the following, if true, ensures packets from a to e always traverse c?

A. Y > 3

B. Y > X + 1

C. Y > X

D. A or B

Page 17: Routing Recitation #3

Which of the following, if true, ensurespackets from b to e always traverse d?

A. Y > 2

B. Y > X + 1

C. Y > X

D. A or B

Page 18: Routing Recitation #3

Which of the following, if true, ensurespackets from b to e always traverse d?

A. Y > 2

B. Y > X + 1

C. Y > X

D. A or B

Page 19: Routing Recitation #3

Initial Routing table at E

Destination Cost Next Hop

A

B

C

D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 20: Routing Recitation #3

Initial Routing table at E

Destination Cost Next Hop

A Inf ---

B

C

D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 21: Routing Recitation #3

Initial Routing table at E

Destination Cost Next Hop

A Inf ---

B Inf ---

C

D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 22: Routing Recitation #3

Initial Routing table at E

Destination Cost Next Hop

A Inf ---

B Inf ---

C 11 C

D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 23: Routing Recitation #3

Initial Routing table at E

Destination Cost Next Hop

A Inf ---

B Inf ---

C 11 C

D 17 D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 24: Routing Recitation #3

Routing table at E after one iteration

Destination Cost Next Hop

A Inf ---

B Inf ---

C 11 C

D 17 D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Page 25: Routing Recitation #3

Destination Cost Next Hop

A 32 D

B Inf ---

C 11 C

D 17 D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after one iteration

Page 26: Routing Recitation #3

Destination Cost Next Hop

A 32 D

B 29 C

C 11 C

D 17 D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after one iteration

Page 27: Routing Recitation #3

Destination Cost Next Hop

A 32 D

B 29 C

C 11 C

D 17 D

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after one iteration

Page 28: Routing Recitation #3

Destination Cost Next Hop

A 32 D

B 29 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after one iteration

Page 29: Routing Recitation #3

Destination Cost Next Hop

A 32 D

B 29 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after two iterations

Page 30: Routing Recitation #3

Destination Cost Next Hop

A 31 C

B 29 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after two iterations

Page 31: Routing Recitation #3

Destination Cost Next Hop

A 31 C

B 28 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after two iterations

Page 32: Routing Recitation #3

Destination Cost Next Hop

A 31 C

B 28 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after two iterations

Page 33: Routing Recitation #3

Destination Cost Next Hop

A 31 C

B 28 C

C 11 C

D 16 C

AA EEDD

CCBB18

21 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

Routing table at E after two iterations

Page 34: Routing Recitation #3

For what value of x does the routing table at E not change anymore after two iterations?

AA EEDD

CCBB18

X 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

(a)For all X >= 2 (b)For all X >= 3(c)For all X <= 4(d)For all X <= 3

Page 35: Routing Recitation #3

For what value of x does the routing table at E not change anymore after two iterations?

AA EEDD

CCBB18

X 12 5 11

1715

Distance Vector RoutingDistance Vector Routing

(a)For all X >= 2 (b)For all X >= 3(c)For all X <= 4(d)For all X <= 3