0% found this document useful (0 votes)
20 views

Linux Networking Cookbook Gregory Boyce instant download

The document provides information about the 'Linux Networking Cookbook' by Gregory Boyce, which includes over 40 recipes for setting up and configuring Linux networks. It outlines various topics such as configuring routers, DNS, IPv6, remote access, web servers, directory services, file storage, email setup, and network monitoring. Additionally, it includes links to other recommended Linux networking books and resources for further exploration.

Uploaded by

urbpoxta165
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Linux Networking Cookbook Gregory Boyce instant download

The document provides information about the 'Linux Networking Cookbook' by Gregory Boyce, which includes over 40 recipes for setting up and configuring Linux networks. It outlines various topics such as configuring routers, DNS, IPv6, remote access, web servers, directory services, file storage, email setup, and network monitoring. Additionally, it includes links to other recommended Linux networking books and resources for further exploration.

Uploaded by

urbpoxta165
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Linux Networking Cookbook Gregory Boyce download

https://ebookbell.com/product/linux-networking-cookbook-gregory-
boyce-34809608

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Linux Networking Cookbook 1st Edition Carla Schroder

https://ebookbell.com/product/linux-networking-cookbook-1st-edition-
carla-schroder-56544592

Linux Networking Cookbook Schroder Carla

https://ebookbell.com/product/linux-networking-cookbook-schroder-
carla-11939232

Linux Networking Clearly Explained 1st Bryan Pfaffenberger Michael


Jang

https://ebookbell.com/product/linux-networking-clearly-explained-1st-
bryan-pfaffenberger-michael-jang-1081324

Advanced Linux Networking Roderick W Smith

https://ebookbell.com/product/advanced-linux-networking-roderick-w-
smith-231883150
Red Hat Linux Networking And System Administration 3rd Edition 3rd
Edition Terry Collings

https://ebookbell.com/product/red-hat-linux-networking-and-system-
administration-3rd-edition-3rd-edition-terry-collings-2411532

Red Hat Linux Networking And System Administration Bkcdrom Terry


Collings

https://ebookbell.com/product/red-hat-linux-networking-and-system-
administration-bkcdrom-terry-collings-919764

Moving From Windows To Linux Networking Series 1st Edition Chuck


Easttom

https://ebookbell.com/product/moving-from-windows-to-linux-networking-
series-1st-edition-chuck-easttom-1998504

Red Hat Linux Networking And System Administration Terry Collings

https://ebookbell.com/product/red-hat-linux-networking-and-system-
administration-terry-collings-60571796

Deep Dive Into Linux Networking Configuring Firewalls Vpns And Secure
Connections Sro

https://ebookbell.com/product/deep-dive-into-linux-networking-
configuring-firewalls-vpns-and-secure-connections-sro-230404272
Linux Networking
Cookbook

Over 40 recipes to help you set up and configure


Linux networks

Gregory Boyce

BIRMINGHAM - MUMBAI
Linux Networking Cookbook

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author(s), nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies
and products mentioned in this book by the appropriate use of capitals. However, Packt
Publishing cannot guarantee the accuracy of this information.

First published: June 2016

Production reference: 1220616

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78528-791-6

www.packtpub.com
Credits

Author Project Coordinator


Gregory Boyce Ulhas K

Reviewer Proofreader
Jean-Pol Landrain Safis Editing

Acquisition Editor Indexer


Sonali Vernekar Hemangini Bari

Content Development Editor Graphics


Onkar Wani Kirk D'Penha

Technical Editor Production Coordinator


Naveenkumar Jain Shantanu N. Zagade

Copy Editor Cover Work


Sneha Singh Shantanu N. Zagade
About the Author

Gregory Boyce is a technologist with nearly 20 years of experience in using and managing
Linux systems. When he's not at work or spending time with his wife and two daughters, he is
playing around with new technologies.

Gregory spent the last 15 years working at Akamai Technologies, where he has worked in
roles ranging from Network Operations, Internal IT, Information Security, Software Testing,
and Professional Services.

Currently, he heads up the Linux OS team that manages Akamai's custom Linux operating
system, which runs on their massively distributed customer facing network.

I'd like to thank my wife, Vanessa, for all the support and Akamai for
surrounding me with such a wonderful assortment of intelligent and
interesting people.
About the Reviewer

Jean-Pol Landrain has a BSc degree in software engineering with a focus in network,
real-time, and distributed computing. He gradually became a software architect with more
than 18 years of experience in object-oriented programming, in particular with C++, Java/JEE,
various application servers, and related technologies.

He works for Agile Partner, an IT consulting company based in Luxembourg. From


early 2006 he became dedicated to the promotion, education, and application of agile
development methodologies.

He has reviewed numerous books both for Manning and Packt Publishing about Docker,
Git, Spring, and message-oriented middleware.

I would like to thank my fantastic wife, Marie, and my 9 year old daughter,
Phoebe, for their daily patience regarding my passion for technology and
the time I dedicate to it. I would also like to thank my friends and colleagues
because a life dedicated to technology would be boring without the fun they
bring to it.
www.PacktPub.com

eBooks, discount offers, and more


Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
[email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.

TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.

Why Subscribe?
ff Fully searchable across every book published by Packt
ff Copy and paste, print, and bookmark content
ff On demand and accessible via a web browser
Table of Contents
Preface v
Chapter 1: Configuring a Router 1
Introduction 1
Setting up the physical network 2
Configuring IPv4 2
Configuring IPv4 permanently 4
Connecting two networks 5
Enabling NAT to the outside 8
Setting up DHCP 10
Setting up a firewall with IPtables 12
Setting up port forwarding 13
Adding VLAN Tagging 14
Chapter 2: Configuring DNS 17
Introduction 17
Setting up your system to talk to a nameserver 17
Setting up a local recursive resolver 19
Configuring dynamic DNS on your local network 21
Setting up a nameserver for your public domain 24
Setting up a slave nameserver 26
Chapter 3: Configuring IPv6 29
Introduction 29
Setting up an IPv6 tunnel via Hurricane Electric 30
Using ip6tables to firewall your IPv6 traffic 31
Route an IPv6 netblock to your local network 32

i
Table of Contents

Chapter 4: Remote Access 35


Introduction 35
Installing OpenSSH 35
Using OpenSSH as a basic shell client 37
Using OpenSSH to forward defined ports 39
Using OpenSSH as a SOCKS proxy 40
Using OpenVPN 41
Chapter 5: Web Servers 45
Introduction 45
Configuring Apache with TLS 46
Improving scaling with the Worker MPM 47
Setting up PHP using an Apache module 49
Securing your web applications using
mod_security 50
Configuring NGINX with TLS 51
Setting up PHP in NGINX with FastCGI 53
Chapter 6: Directory Services 55
Introduction 55
Configuring Samba as an Active Directory compatible directory service 55
Joining a Linux box to the domain 60
Chapter 7: Setting up File Storage 63
Introduction 63
Serving files with SMB/CIFS through Samba 63
Granting authenticated access 65
Setting up an NFS server 65
Configuring WebDAV through Apache 68
Chapter 8: Setting up E-mail 73
Introduction 73
Configuring Postfix to send and receive e-mail 74
Setting up DNS records for e-mail delivery 78
Configuring IMAP 79
Configuring authentication for outbound e-mail 81
Configuring Postfix to support TLS 83
Blocking spam with Greylisting 83
Filtering spam with SpamAssassin 85

ii
Table of Contents

Chapter 9: Configuring XMPP 87


Introduction 87
Installing ejabberd 87
Configuring DNS for XMPP 95
Configuring the Pidgin client 96
Chapter 10: Monitoring Your Network 101
Introduction 101
Installing Nagios 102
Adding Nagios users 102
Adding Nagios hosts 104
Monitoring services 105
Defining commands 106
Monitoring via NRPE 107
Monitoring via SNMP 109
Chapter 11: Mapping Your Network 111
Introduction 111
Detecting systems on your network with NMAP 112
Detecting Systems Using Arp-Scan 113
Scanning TCP ports 115
Scanning UDP ports 117
Identifying services 119
Identifying operating systems 120
Chapter 12: Watching Your Network 123
Introduction 123
Setting up centralized logging 124
Installing a Snort IDS 126
Managing your Snort rules 128
Managing Snort logging 130
Index 133

iii
Preface
Network administration is one of the main tasks of Linux system administration. By knowing
how to configure system network interfaces in a reliable and optimal manner, Linux
administrators can deploy and configure several network services including file, web,
mail, and servers while working in large enterprise environments.

What this book covers


Chapter 1, Configuring a Router, starts by getting you to manually configure the IP address
information on your system and then properly configure the system to bring up its interfaces
automatically. From there, we'll move on to extending our system to act as a router for your
own network, including DHCP for dynamically configuring client systems.

Chapter 2, Configuring DNS, will cover setting up your internal DNS server for both resolving
external hostnames for you, as well as hosting DNS records for your own domain.

Chapter 3, Configuring IPv6, will provide a brief introduction of IPv6. We'll configure a tunnel to
provide IPv6 connectivity, implement firewalling using iptables6, and provide IPv6 addresses
to the rest of your network.

Chapter 4, Remote Access, will look at methods for remotely interacting with your new network
using OpenSSH and OpenVPN.

Chapter 5, Web Servers, will set up web servers hosting PHP code, using both the Apache
HTTPD server and NGINX.

Chapter 6, Directory Services, will tell us how to use Samba 4 to create an Active
Directory-compatible directory service for your network.

Chapter 7, Setting up File Storage, will give us several options to explore for hosting your own
file storage, including Samba, NFS, and WebDAV.

v
Preface

Chapter 8, Setting up E-mail, will tell us how to set up an e-mail server. We'll talk about how
e-mail works as a service, set SMTP and IMAP mail services, and enable some spam filtering.

Chapter 9, Configuring XMPP, will tell us how to configure our own XMPP based IM service,
configure it to communicate with other XMPP services, and configure Pidgin as a client to
utilize the service.

Chapter 10, Monitoring Your Network, will tell us how to start monitoring services on our
network using Nagios.

Chapter 11, Mapping Your Network, will cover mapping out the network in order to discover
what is actually there.

Chapter 12, Watching Your Network, will cover watching over our network through centralized
logging and managing an intrusion detection system using Snort.

What you need for this book


For this book you'll need a copy of Linux, preferably Ubuntu 14.04.

You'll also want access to three computers to install Linux on. One of the servers will need to
have three network cards built into it.

For this purpose, I would strongly recommend using Virtual machines (VMs). Virtual Box
will allow you to do this for free and is available on Windows, Linux, or OS X. You may find
that the commercial offerings from VMWare, Parallels, or Microsoft may provide better
performance, however.

Who this book is for


This book is targeted at Linux system administrators who have a good basic understanding
and some prior experience of how a Linux machine operates, but want to better understand
how various network services function, how to set them up, and how to secure them. You
should be familiar with how to set up a Linux server and how to install additional software
on them.

Conventions
In this book, you will find a number of text styles that distinguish between different kinds of
information. Here are some examples of these styles and an explanation of their meaning.

vi
Preface

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"Modify /etc/default/isc-dhcp-server to add the interface which you should
serve requests on."

A block of code is set as follows:


auto eth0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0

Any command-line input or output is written as follows:


# ip link set dev eth0 up
# ip link show eth0

New terms and important words are shown in bold. Words that you see on the screen,
for example, in menus or dialog boxes, appear in the text like this: "Under User Functions,
click Create Regular Tunnel. You may create up to 5 tunnels."

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or disliked. Reader feedback is important for us as it helps us
develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the


book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide at www.packtpub.com/authors.

vii
Preface

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to
get the most from your purchase.

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be
grateful if you could report this to us. By doing so, you can save other readers from frustration
and help us improve subsequent versions of this book. If you find any errata, please report them
by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on
the Errata Submission Form link, and entering the details of your errata. Once your errata are
verified, your submission will be accepted and the errata will be uploaded to our website or
added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works in any form on the Internet, please provide us with
the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected


pirated material.

We appreciate your help in protecting our authors and our ability to bring you
valuable content.

Questions
If you have a problem with any aspect of this book, you can contact us at questions@
packtpub.com, and we will do our best to address the problem.

viii
Chapter 1

Configuring a Router
1
In this chapter, we will cover:

ff Setting up the physical network


ff Configuring IPv4
ff Configuring IPv4 permanently
ff Connecting two networks
ff Enabling NAT to the outside
ff Setting up DHCP
ff Setting up a firewall with IPtables
ff Setting up port forwarding
ff Adding VLAN Tagging

Introduction
This chapter introduces some of the basic networking concepts and the methods to utilize
them on Linux systems. It provides us with a good base to build upon. We're going to start
with two computers connected with a single network cable and work our way from there to
configure a router to connect your network to the Internet.

Routers are devices that are configured to span multiple networks and forward packets
between them as needed. They also perform Network Address Translation (NAT) in order
to allow your private network to share a single public IPv4 address.

1
Discovering Diverse Content Through
Random Scribd Documents
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like