100% found this document useful (1 vote)
478 views

Download Rust for Network Programming and Automation Learn to Design and Automate Networks Performance Optimization Brian Anderson ebook All Chapters PDF

Networks

Uploaded by

scheonipa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
478 views

Download Rust for Network Programming and Automation Learn to Design and Automate Networks Performance Optimization Brian Anderson ebook All Chapters PDF

Networks

Uploaded by

scheonipa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Get ebook downloads in full at ebookmeta.

com

Rust for Network Programming and Automation Learn


to Design and Automate Networks Performance
Optimization Brian Anderson

https://ebookmeta.com/product/rust-for-network-programming-
and-automation-learn-to-design-and-automate-networks-
performance-optimization-brian-anderson/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://ebookmeta.com


RUST FOR NETWORK
PROGRAMMING AND
AUTOMATION
Learn to Design and Automate
Networks, Performance Optimization,
and Packet Analysis with low-level
Rust

Brian Anderson
Copyright © 2023 GitforGits
All rights reserved.
ISBN: 978-8196228538
Contents
Preface
Chapter 1: Basics of Network Automation
Need of Network Automation
Evolution of Network Management
Necessity and Rise of Network Automation
Opportunities for Today and Future
Types of Network Automation
Configuration Automation
Network Monitoring Automation
Provisioning Automation
Security Automation
Software Defined Networks
Understanding SDN Architecture
Types of SDN
Network Protocols
Role of Network Protocols
Importance of Network Protocols
Types of Network Protocols
Network Automation Tools
Role of Network Automation Tools
Network Automation Tool Categories
Network Automation Architectures
Network Devices
Network Automation Tools
Network Automation Engine
Summary
Chapter 2: Essentials of Linux for Networks
Overview of Network-Related Commands
Purpose of Network Related Commands
Advantages of Network Commands
Examples of Network Commands:
Using ‘ifconfig’
Using ‘iwconfig’
Using ‘dig’
Using ‘traceroute’
Using ‘netstat’
Using ‘nslookup’
Searching Wireless Devices
Using ‘iwlist’
Modifying IPv4 Addresses
Understanding IPv4
Modifying the Addresses (IPv4)
Modifying IPv6 Addresses
Deleting IP Address
Cloning IP Addresses
What is Cloning of IP Address?
Steps to Clone IP
How to Clone the IP Address
Considerations While Cloning IP
Evaluating DNS Server
Need of DNS Evaluation
Steps to Evaluate DNS Server
Modifying DNS Server
Ways to Modify DNS Server
Summary
Chapter 3: Rust Basics for Networks
Overview
Variables
Constants
Functions
Control Flow
If Statements
Loop Statements
While Statements
For Statements
Pattern Matching
Summary
Chapter 4: Core Rust for Networks
Mutability
Overview
Application of Mutability in Network Programming
Sample Program on Mutability
Ownership
Overview
Sample Program on Ownership
Borrowing
Overview
Sample Program on Borrowing
Borrowing for Data Buffers
Structs
Overview
Struct Syntax
Enums & Pattern Matching
Overview
Enum Syntax
Pattern Matching
Use of Enums
Enums for Simple Server
Data Enumeration
Traits
Using Trait Syntax
Sample Program to use Trait in Networks
Error Handling
Overview
Result, Ok and Err
Panic! Macro
Summary
Chapter 5: Rust Commands for Networks
Standard Commands In-Use
Networking Commands
std::net
tokio
hyper
env_logger
reqwest
Summary
Chapter 6: Programming & Designing Networks
LAN
Overview of LAN Setup
Defining Network Topology using Graphviz
Assign IP Address
Configure Network Devices using Netlink
WAN
Overview of WAN Setup
Determine Network Requirements
Choose the WAN Technology
Select a WAN Service Provider
Configure the WAN Routers
Configure the WAN Interfaces
WLAN
Overview of WLAN Setup
End-to-end Setup of a WLAN
Cloud Networks
End-to-end Setup of a Cloud Network
VPN
Stages to Configure a VPN
Rust Program to Setup VPN
Data Center Network
Stages to Setup a Data Center Network
Rust Program to Setup a Data Center Network
Summary
Chapter 7: Establishing & Managing Network Protocols
Establishing TCP/IP
Choose Port Number
Bind to a Socket
Accept Incoming Connections
Process Incoming Data
Handle Errors
Choose Port Number
Allocation of Port Numbers
Application-wise Port Numbers
Selection of Rust Networking Library
Tokio
Mio
Rust-async
Installing and Configuring Tokio
Installing and Configuring Mio
Installing and Configuring Rust-async
Creating TCP Listener/Binding Socket
Understanding Binding Sockets and TCP Listening
Create TCP Listener using Tokio and Mio
Create TCP Listener using Rust-async
Accept Incoming Connections
Overview
Steps to Accept Connections
Accept Incoming Connections using Tokio
Accept Incoming Connections using Mio
Accept Incoming Connections using Rust-async
Processing of Incoming Data
Process Incoming Data with Tokio
Process Incoming Data with Mio
Process Incoming Data with Rust-async
Handle Errors
Handling Errors using Tokio
Handling Errors using Mio
Handling Errors using Rust-async
Summary
Chapter 8: Packet & Network Analysis
Understanding Packets
Packet Manipulation Tools
Overview
pnet
libtin
Create a Packet Capture Loop
Overview
Packet Capture Process
Capturing Packets using pnet
Process the Captured Packets
Overview
Procedure to Process Captured Packets
Processing Captured Packets using pnet
Analyze the Captured Packets
Overview
Packet Analysis Use-cases
Analyzing Packets
Summary
Chapter 9: Network Performance Monitoring
Network and Performance Monitoring
Why Monitoring Networks?
Performance Monitoring Techniques
Network Performance Metrics & Indicators
Understanding Network Performance Metrics
Exploring Network Performance Indicators
Monitoring Network Availability
Setting Up the Project
Implementing Network Monitoring
Setting Up Monitoring Alerts
Putting It All Together
Running the Application
Monitoring Network Utilization
Setting Up the Project
Implementing Network Utilization Monitoring
Setting Up Monitoring Alerts
Putting It All Together
Running the Application
Monitoring Latency, Packet Loss and Jitter
Installing the pingr Crate
Sending Ping Requests
Continuously Monitoring Latency
Summary
Preface
Rust for Network Programming and Automation is a
pragmatic guide that trains you through the Rust to design networks
and begin with automating network administration. The book
introduces you to the powerful libraries and commands of Rust that
are essential for designing, administering and automating networks.
You will learn how to use Rust's networking libraries like tokio, mio
and rust-async to create scalable and efficient network applications.
The book provides a wide range of practical examples and use-
cases, which help to simplify complex coding concepts and ensure
that you understand the material in-depth. You will discover how to
establish network protocols like TCP and IP networks, run packet
and network analysis, measure performance indicators and set up
monitoring alerts and notifications. The book is an excellent resource
for network engineers and administrators who want to gain a deep
understanding of Rust programming for networking.
The author of "Rust for Network Programming and Automation" has
a wealth of experience in network programming and automation
with practical insights. The book is perfect for anyone who wants to
master Rust programming for network automation and gain a
competitive edge in the field. Whether you are a beginner or an
experienced programmer, this book will provide you with the
knowledge and skills you need to excel in network programming and
automation using Rust .
In this book you will learn how to:
Use Rust to automate network configuration, deployment,
and maintenance tasks
Capture and inspect packets, decode protocols, and
analyze network traffic
Set up monitoring alerts, notifications, and manage
network infrastructure
Create scripts and applications that automate repetitive
network tasks
Monitor network performance indicators like latency,
throughput, and packet loss
Understand Rust's syntax, data types, control structures,
and functions
Make use of Rust's networking libraries like Tokio, mio
and rust-async to create networking programs
Establish network connections and handle data
transmission between different devices
GitforGits
Prerequisites
This book assumes you are absolutely new to rust programming and
believes in rust to make some of the great performing applications.
If you know any other programming prior to this book, reading this
book at speed can finish truly in a day.
Rust is a modern, safe and efficient systems programming language
that is widely used in industry and is a good choice for developers
who want to build high-performance, concurrent, and safe systems.

Codes Usage
Are you in need of some helpful code examples to assist you in your
programming and documentation? Look no further! Our book offers
a wealth of supplemental material, including code examples and
exercises.

Not only is this book here to aid you in getting your job done, but
you have our permission to use the example code in your programs
and documentation. However, please note that if you are
reproducing a significant portion of the code, we do require you to
contact us for permission.

But don't worry, using several chunks of code from this book in your
program or answering a question by citing our book and quoting
example code does not require permission. But if you do choose to
give credit, an attribution typically includes the title, author,
publisher, and ISBN. For example, "Rust for Network Programming
and Automation by Brian Anderson".

If you are unsure whether your intended use of the code examples
falls under fair use or the permissions outlined above, please do not
hesitate to reach out to us at kittenpub.kdp@gmail.com .
We are happy to assist and clarify any concerns.
Other documents randomly have
different content
Pecan balls.—Toast pecans by spreading 1½ cups in a shallow
pan, and baking at 300° F. (slow oven) 15 to 20 minutes, or until
lightly browned. Cool and chop. Shape 1 quart ice cream into 6 balls.
Roll balls in pecans. Place on a tray covered with wax paper and
return to freezer until firm. Just before serving, top balls with hot
fudge sauce. Makes 6 servings.
Snowballs.—Shape 1 quart ice cream into 6 balls. Roll balls in ½
cup flaked coconut. Return balls to freezer as directed above. Makes
6 servings.
Ice cream sandwiches.—Slice 1 quart ice cream into 6 slices.
Place each slice between 2 graham crackers (plain, cinnamon-
flavored, or chocolate-coated). Serve immediately or return to
freezer until time to serve. Makes 6 sandwiches.
Buttered nut sundae.—Add ½ cup chopped pecans or walnuts to 2
tablespoons melted butter or margarine in a frypan. Toast nuts over
low heat for 15 to 20 minutes, stirring as needed, until they are lightly
browned. Stir in ¼ cup brown sugar (packed) and ¼ cup water;
simmer 2 minutes. Pour warm sauce over ice cream. Makes about ¾
cup or enough for 6 sundaes.
Ways to Use Leftovers
Don’t throw good leftover food away. Use your cooking skill—and
your imagination—to make leftovers tasty.
Some leftovers make good second meals merely by reheating.
Others are better prepared in a new way—with seasonings, sauces,
crisp toppings. Try leftover fruit in muffins, vegetables in omelets.
Substitute 2 leftover egg yolks for 1 whole egg in baked custard. And
soups often become richer, more delicious when leftovers are added.
Listed below are some of the ways in which leftovers may be
used.
Egg yolks, in—
Baked custard
Cakes, cookies
Homemade noodles
Mock hollandaise sauce
Scrambled eggs
Egg whites, in—
Cakes
Meringue
Souffles
Hard-cooked egg or yolk, in—
Casseroles
Egg sauce
Garnish
Salads
Sandwiches
Thousand island dressing
Buttermilk, in—
Cakes, cookies
Quick breads
Sour cream, in—
Beef stroganoff
Cakes, cookies
Salad dressings
Sauce for vegetables
Cooked meats, poultry, fish, in—
Casseroles
Creamed foods
Curries
Hash
Patties
Potpies
Salads
Sandwiches
Meat or poultry drippings and broth, in—
Gravies
Sauces
Soups
Stews
Cooked potatoes, in—
Fried or creamed potatoes
Meat or potato patties
Meat-pie topping
Potatoes in cheese sauce
Salads
Soups, stews, or chowders
Cooked snap beans, lima beans, corn, peas, carrots, in—
Casseroles
Creamed dishes
Meat, poultry, or fish pies
Salads
Sauces
Scalloped vegetables
Soups
Stews
Vegetables in cheese sauce
Cooked leafy vegetables, chopped, in—
Creamed or scalloped vegetables
Omelets
Souffles
Soups
Vegetable cooking liquids, in—
Gravies
Sauces
Soups
Stews
Cooked or canned fruits, in—
Fruit cups
Fruit sauces
Gelatin desserts
Prune cake
Quick breads
Salads
Shortcake
Upside-down cake
Yeast breads
Fruit cooking liquids or fruit sirups, in—
Fruit cups
Fruit sauces
Fruit drinks
Gelatin mixtures
Tapioca puddings
Cooked wheat, oat, or corn cereals, in—
Fried cereal
Meat loaf or patties
Souffles
Sweet puddings
Cooked rice, noodles, macaroni, spaghetti, in—
Baked macaroni and cheese
Casseroles
Macaroni salad
Meat or cheese loaf
Spanish rice
Bread, in—
Bread pudding
Croutons
Dry crumbs for breading meat, poultry, or fish
Fondues
French toast
Meat loaf, salmon loaf
Sardine puff
Stuffings
Cookies or unfrosted cake, in—
Crumb crust for pies
Ice cream sandwiches
Refrigerator cake (cake strips or cookies layered with
pudding or whipped cream and chilled)
Toasted cake slices, served with fruit or ice cream
Cooking Terms

Bake To cook in an oven or oven-type appliance in a


covered or uncovered container.
Barbecue To roast slowly on a spit or rack, usually basting with
a highly seasoned sauce. Also, foods cooked in or
served with barbecue sauce.
Baste To pour melted fat, drippings, or other liquid over
food to moisten it during cooking.
Boil To cook in water or other liquid at boiling
temperature (212° F. at sea level). Bubbles rise
continually and break on the surface.
Braise To cook meat or poultry slowly in steam from meat
juices or added liquid trapped and held in a covered
pan. Meat may be browned in a small amount of fat
before braising.
Broil To cook uncovered on a rack placed directly under
heat or over an open fire.
Pan broil.—To cook in uncovered pan over direct
heat, pouring fat off as it accumulates.
Caramelize To heat sugar or food containing sugar until a brown
color and characteristic flavor develop.
Fold To combine two mixtures (or two ingredients such as
beaten egg white and sugar) by gently cutting down
through mixture, turning over, and repeating until
well mixed.
Fry To cook in fat without water, uncovered.
Pan-fry or saute.—To cook in frypan in a small
amount of fat.
Deep-fry or french-fry.—To cook in a deep kettle,
in enough fat to cover or float food.
Grill Same as broil.
Knead To press, stretch, and fold dough or other mixture to
make it elastic or smooth. Bread dough becomes
elastic; fondant becomes smooth and satiny.
Marinate To let foods stand in a liquid (usually mixture of oil
with vinegar or lemon juice) to add flavor or to make
more tender.
Parboil To boil until partly cooked.
Poach To simmer gently in liquid so food retains its shape.
Pot-roast To cook large cuts of meat by braising.
Reconstitute To restore concentrated food—such as frozen
orange juice or dry milk—to its original state, usually
by adding water.
Rehydrate To soak or cook dried foods to restore the water lost
in drying.
Roast To cook in heated air—usually in an oven—without
water, uncovered.
Simmer To cook in liquid just below the boiling point, at
temperatures of 185° to 210° F. Bubbles form slowly
and break below the surface.
Steam To cook food in steam, with or without pressure.
Food is steamed in a covered container on a rack or
in a perforated pan over boiling water.
Stew To cook in liquid, just below the boiling point.
Index to Recipes
Apple(s):
baked, 72
crisp, 72
pie, 64

Barbecued beef sandwiches, 63


Bean(s):
Boston baked, 41
green:
creole, 46
ham-seasoned, 47
mushroom casserole, 48
lima, creole, 46
salads, marinated, 50
soup, 55
Beef:
braised, 21
broiled, 18
liver and onions, braised, 24
loaf, 25
pan-broiled, 20
pie, quick, 22
pot roast, 21
roast, 18
stew, 26
stroganoff, 22
(See also Sandwiches.)
Beets, Harvard, 47
Biscuit(s):
cheese, 60
plain, 60
sweet (shortcake), 60
Bread(s):
coffee cake, quick, 62
cornbread, 60
croutons, 56
french toast, 37
nut bread, 61
pancakes, 62
popovers, 60
pudding, raisin-nut, 73
spoonbread, 61
waffles, 62
(See also Biscuits, Muffins, Rolls, Sandwiches.)

Cabbage, hungarian, 45
Cake(s):
chocolate, 69
coffee, quick, 62
frosting:
caramel-nut, 69
chocolate, creamy, 69
white, creamy, 69
spiced prune, 67
upside-down, 68
velvety white, 67
Carrots, glazed, 47
Cauliflower au gratin, quick, 46
Cheese:
baked fondue, 40
biscuits, 60
burgers, fish, 63
croutons, 56
pizza, 40
salad dressing, Roquefort (blue), 53
sauce with macaroni, 40
with spanish rice, 39
Cherry:
cobbler, 68
cobbler, quick, 69
pie, 65
Chicken:
a la king, 30
braised, with vegetables, 31
broiled, 29
fried, 29
noodle bake, 30
oven-fried, 29
pie, 31
roast, 27
stewed, 29
vegetable soup, 54
with homemade noodles, 32
Chowder. (See Soup.)
Coleslaw, 52
Cookies:
brownies, chewy, 72
brownies, plain, 72
chocolate chip, 71
chocolate sparkles, 71
cinnamon-sugar, 71
molasses snaps, 71
oatmeal:
coconut or nut, 70
orange, 70
plain, 70
raisin, 70
peanut butter, 70
top hat, 71
Corn muffins, 61
Cornbread, 60
Cranberry-baked apples, 72
Croutons, 56
Custard, baked, 73

Desserts:
apple crisp, 72
apples, baked, 72
bavarian cream, orange, 70
cobbler, cherry, 68
raisin-nut bread pudding, 73
(See also Cakes, Cookies, Custard, Ice Cream Desserts, Pies.)
Duck, roast, 27

Eggplant:
casserole, 47
creole, 46
Egg(s):
baked in hash nests, 39
deviled:
ham, 38
plain, 38
french toast, 37
fried, 37
in shell:
hard-cooked, 37
soft-cooked, 37
omelet, plain (french), 38
poached, 38
poached, supreme, 38
sauce, 57
scrambled, 36

Fish:
baked, 34
baked stuff, 35
broiled, 34
buying, 10
cheeseburgers, 63
chowder:
Manhattan, 55
New England, 55
deep-fat fried, 32
oven-fried, 35
pan-fried, 32
salad, souffle, 51
salmon loaf, 34
sardine puff, 36
servings per pound, 7
storing, 14
topsy turvy tuna pie, 35
Frosting. (See Cakes.)
Fruits. (See Desserts, Pies.)

Gingerbread, 68
Goose, roast, 27
Graham cracker pie crust, 65
Gravy, 57

Ham:
patties, 24
roast, 18
slice, broiled, 18
slice, pan-broiled, 20

Ice cream desserts:


buttered nut sundae, 73
ice cream sandwiches, 73
pecan balls, 73
snowballs, 73
Lamb:
braised, 21
chops, broiled, 18
chops, pan-broiled, 20
curried, 23
roast, 18
stew, irish, 26
Liver and onions, braised, 24
Luncheon meat:
saucy, 25
special, 23

Macaroni with cheese sauce, 40


Meat:
buying, 8
curried, 23
grades, 8
loaf 25
salad sandwiches, 63
salad, souffle, 51
servings per pound, 7
storing, 14
(See also Beef, Lamb, Liver, Luncheon Meat, Pork, Sausage,
Veal.)
Meringue-topped pie, quick, 66
Muffins:
blueberry, 61
bran, 61
corn, 61
oatmeal-raisin, 61
plain, 61

Noodle(s):
chicken bake, 30
homemade, with chicken, 32
turkey bake, 30

Oatmeal:
cookies, 70
raisin muffins, 61
Okra and tomatoes, stewed, 45
Omelet, plain (french), 38
Onion(s):
and liver, braised, 24
in mushroom sauce, 48
sauce, 57

Pancakes, 62
Pastry, for pies, 64
Pea salad, 53
Peanut butter cookies, 70
Peppers, green, stuffed, 25
Pie(s):
apple, 64
blueberry, 65
cherry, 65
chicken, 31
cream:
banana, 65
chocolate, 65
coconut, 65
vanilla, 65
fruit delight, 67
graham cracker crust, 65
lemon chiffon, 66
lime chiffon, 67
pastry, 64
peach, 65
pecan, 66
pumpkin, 66
quick meringue-topped, 66
turkey, 31
Pizza, 40
Popovers, 60
Pork:
braised, 21
chops, broiled, 20
curried, 23
roast, 18
(See also Ham.)
Potato(es):
and sausage, au gratin, 23
baked stuffed, 48
patties, 48
salad, 52
soup, creamy, 56
Poultry:
salad, sandwiches, 63
salad, souffle, 51
(See also Chicken, Duck, Goose, Turkey.)
Prune:
cake, spiced, 67
salad, stuffed, 52
Pudding, raisin-nut bread, 73

Rice, spanish with cheese, 39


Rolls, yeast:
cinnamon-nut, 59
cloverleaf, 60
crescent, 59
plain, 59

Salad(s):
chef salad bowl, luncheon, 52
coleslaw, 52
creamy fruit, 51
fish, souffle, 51
frozen fruit, 51
marinated vegetable, 50
asparagus spear, 50
cucumber and onion, 50
green bean, 50
three-bean, 50
meat, souffle, 51
pea, 53
pineapple-carrot, molded, 51
potato, 52
poultry, souffle, 51
prune, stuffed, 52
suggested combinations:
fruit, 50
vegetable, 50
Salad dressing(s):
blue cheese, 53
celery seed, 53
french:
basic, 53
sweet, 53
orange-honey, 53
italian, 53
Roquefort cheese, 53
thousand island, 53
Sandwich(es):
bacon-cheese, 62
barbecued beef, 63
fish-cheeseburgers, 63
grilled open-face, 63
meat salad, 63
poultry salad, 63
Sauces:
cheese, 57
egg, 57
honey-orange, 58
lemon-butter, 58
mock hollandaise, 58
onion, 57
quick vegetable, 58
sour cream, 58
tartar, 58
white, 57
Sausage and potatoes au gratin, 23
Soup(s):
bean, 55
broccoli, cream of, 56
chicken-vegetable, 54
fish chowder:
Manhattan, 55
New England, 55
potato, creamy, 56
turkey-vegetable, 54
vegetable, hearty, 54
Spaghetti with meat sauce, 24
Spinach:
au gratin, quick, 46
souffle, 44
Spoonbread, 61
Squash, zucchini, scalloped, 46
Steak(s):
braised, 21
broiled, 18
pan-broiled, 20
Stew:
beef, 26
irish, 26
Stuffing:
nut, 28
plain, 28
Sweetpotatoes in orange shells, 45

Tomato(es):
and okra, stewed, 45
broiled, 45
Turkey:
boneless roast, 28
noodle bake, 30
pie, 31
roast, stuffed, 27
vegetable soup, 54

Veal:
braised, 21
curried, 23
roast, 18
Vegetable(s):
boiled, 42
chicken soup, 54
creamed, 43
mashed, 43
panned, 44
salad combinations, 50
salads, marinated, 50
sauce, quick, 58
soup, hearty, 54
turkey soup, 54
with a sauce, 44
with braised chicken, 31
(See also other Vegetables, Salads, Sauces, Soups.)

Waffles, 62

You might also like