Linux Networking and Security
Meeting 8 Palomar College CSNT – 141 Norman McEntire
[email protected]
Copyright (c) 2010 Servin Corporation
1
Today's Agenda ●
About WebEx Recordings
●
Midterm Review Session
Copyright (c) 2010 Servin Corporation
2
About WebEx Recordings ●
The WebEx recordings will be removed on Monday April 26, 2010 –
●
I'm canceling my WebEx service contract
If you want to keep the recordings, download them before Monday! –
Download and the recordings will be saved at .ARF (WebEx Audio Recording Format).
–
Then convert the .ARF recordings to .WMV to play them Copyright (c) 2010 Servin Corporation
3
Midterm Exam Guidelines ●
Goal is to make the Midterm similar to a job interview for a Linux Network Admin. –
Just like any other interview, you'll not have access to your book or notes --- only the head on your shoulders! ●
● ●
To repeat: the written portion of exam is CLOSED BOOK and FILL IN THE BLANK. Just like an interview!
Two parts: Written + Hands-On For Hands-On: You will be given NEW virtual machine and have to configure as required Copyright (c) 2010 Servin Corporation
4
Midterm Review Session ●
●
● ●
What follows are sample questions/answers that you may be asked on the Midterm Exam Make sure you know the answers to these questions without using books or notes Make sure you can do the lab exercises! ALSO: Make sure you review the notes from Monday class – lots of commands!
Copyright (c) 2010 Servin Corporation
5
Chapter 12: TCP/IP Networking ● ●
●
●
Here are possible questions from Chapter 12. Remember: the exam will be like an itnerview, closed book, closed notes Q. What do the letters TCP/IP stand for? –
Transmission Control Protocol
–
Internet Protocol
Q. Is TCP/IP a single protocol or a suite of protocols? –
TCP/IP is a suite of protocols, e.g., http, ftp, etc. Copyright (c) 2010 Servin Corporation
6
Chapter 12: TCP/IP Networking ●
●
Q. ____ is a connection-oriented protocol –
TCP
–
“think registered mail with guaranteed delivery”
Q. ____ is a connection-less (packet-oriented) protocol –
UPD (User Datagram Protocol)
–
“think standard mail delivery with no guarantee but most likely it will make it”
Copyright (c) 2010 Servin Corporation
7
Chapter 12: TCP/IP Networking ●
●
Q. Name the five layers of the TCP/IP networking model, giving a brief definition of each layer –
Application Layer – end-user apps, e.g. Web browser
–
Transport Layer – transport of data
–
Network Layer – addressing and routing
–
Link Layer – network hardware and media access
–
Physical Layer – the cable/wireless radio
NOTE: See Table 12.1 in your textbook Copyright (c) 2010 Servin Corporation
8
Chapter 12: TCP/IP Networking ●
Q. Given Exhibit A in your textbook, show an example Linux command that can be used to troubleshoot each layer –
Application – ssh, ftp, http
–
Transport – lsof -i, netstat -atp, netstat -aup
–
Network Layer – ifconfig (IP addr), ping, route
–
Link Layer – ifconfig (MAC addr), arp -a
–
Physical layer - ethtool
Copyright (c) 2010 Servin Corporation
9
Chapter 12: TCP/IP Networking ●
Q. What file contains a mapping service names (e.g. Ssh, ftp, etc.) to port numbers? –
●
Q. What file maps IP address to host names? –
●
/etc/hosts
Q. Give an example of a MAC address –
●
/etc/services
00:0c:29:9c:80:12
Q. Give an example of an IP address –
192.168.1.1 Copyright (c) 2010 Servin Corporation
10
Chapter 12: TCP/IP Networking ●
●
Remember! Midterm written exam is CLOSED BOOK and CLOSED NOTES, just like an interview. Q. Name the command used to display the MAC address of eth0 –
●
ifconfig eth0
Q. Name the command used to display the IP address of eth0 –
ifconfig eth0 Copyright (c) 2010 Servin Corporation
11
Chapter 12: TCP/IP Networking ●
●
There are three IP networks that are reserved for private use. (See Table 12.7 in textbook). Name the network address for each of the three private networks –
10.0.0.0/8
–
172.16.0.0/12
–
192.168.0.0/16
Q. Name the command to display routing tables –
route, netstat -rn Copyright (c) 2010 Servin Corporation
12
Chapter 12: TCP/IP Networking ●
Q. Use this command to display the hostname –
●
Q. Use this file to set the hostname –
●
/etc/sysconfig/network
Q. Use this file to map an IP address to a hostname –
●
Hostname
/etc/hosts
Q. This file created by dhclient-script –
/etc/resolv.conf Copyright (c) 2010 Servin Corporation
13
Lab Exercise ●
Configure your system so that NO network interfaces come up at boot time –
Hints: /etc/sysconfig/network-scripts
Copyright (c) 2010 Servin Corporation
14
Chapter 12: TCP/IP Networking ●
Q. Use this file to set a static IP address for eth0 –
●
Q. Use this to restart the network service –
●
service network restart
Q. Use this command to bring up eth0 –
●
/etc/sysconfig/network-scripts/ifcfg-eth0
ifup eth0
Q. Use this command to take eth0 down –
ifdown eth0 Copyright (c) 2010 Servin Corporation
15
Chapter 12: TCP/IP Networking ●
Q. Define DHCP –
●
Q. How does the word “lease” relate to DHCP? –
●
Dynamic Host Configuration Protocol DHCP clients lease IP address (and other info) from DHCP server
Q. Name three addresses most commonly given to a DHCP client from a DHCP server –
1. IP Address; 2. gateway; 3. DNS server Copyright (c) 2010 Servin Corporation
16
Lab Exercise ● ●
Install a DHCP server Setup the configuration file to serve this range of addresses –
●
192.168.1.0 – 192.168.1.254
Do NOT enable the DHCP server
Copyright (c) 2010 Servin Corporation
17
Chapter 13. Routing ●
● ●
For this midterm, you can skip most of this chapter. However, know these questions/answers Q. Show TWO different commands that both display the internal routing tables –
route
–
netstat -rn
Copyright (c) 2010 Servin Corporation
18
Chapter 14. Network Hardware ●
● ●
For this midterm, you can skip most of this chapter. However, know these questions/answers Q. Determine if one or more eth interfaces wrote messages to the kernel ring buffer –
●
dmesg | grep eth
Q. List the PCI NICs in your machine –
lspci | grep net Copyright (c) 2010 Servin Corporation
19
Chapter 14. Network Hardware ●
Q. Find the Linux driver associated with a given network adapter –
●
Q. Show info about the pcnet32 device driver –
●
lshal | grep net | grep driver modinfo pcnet32
Q. What RPM package contains the wireless networking commands –
wireless-tools Copyright (c) 2010 Servin Corporation
20
Demo: Explore Wireless Tools ●
rpm -qi wireless-tools
●
rpm -ql wireless-tools
●
iwconfig
●
iwlist
●
iwevent
Copyright (c) 2010 Servin Corporation
21
Chapter 15: DNS ●
For this midterm, you can skip most of this chapter. –
●
Q. Define the letters DNS –
●
Domain Name System
Q. What does DNS do? –
●
However, know these questions/answers
Map hostnames to IP address
Q. Name three commands useful with DNS –
1. host; 2. dig; 3. nslookup Copyright (c) 2010 Servin Corporation
22
Lab Exercise ●
●
●
Install the BIND (Berkeley Internet Name Daemon) package to use as a DNS server Install the necessary files for a caching DNS server Do not enable the DNS at this time
Copyright (c) 2010 Servin Corporation
23
Chapter 16. NFS ●
Q. Define the letters NFS –
●
Q. When do you use NFS? –
●
Network File System Use NFS to share files between UNIX and Linux systems
Q. Name the key configuration file related to NFS –
/etc/exports Copyright (c) 2010 Servin Corporation
24
Chapter 16. NFS ●
Q. Show the command to start NFS –
●
Q. What command to show nfs exports? –
●
showmount –exports
Q. Show the command to mount a NFS export –
●
service nfs start
mount //HOST/SHARE /mnt/MOUNTPONT
Q. Show how to access a NFS export using automount –
ls /net/HOST Copyright (c) 2010 Servin Corporation
25
Chapter 16. NFS ●
Q. How to display NFS statistics? –
●
Q. What is the relationship of portmapper to NFS? –
●
nfsstat
NFS uses rpc (remote procedure call), and portmapper handles RPC
Q. What command shows NFS related SELinux info? –
man nfs_selinux Copyright (c) 2010 Servin Corporation
26
Chapter 16. NFS ●
Q. What does root_squash do for NFS? –
●
A root user (id 0) using NFS becomes nfsnobody
Q. Does NFS require installing any additional packages? –
No. NFS is included in most Linux distros by default
Copyright (c) 2010 Servin Corporation
27
Lab Exercise ●
●
Setup an NFS server to share the files under /midterm as read/write, with root squash. Create a file name /midterm/readme.nfs.txt with text as follows –
●
“This is readme.nfs.txt file”
Confirm that you can access the NFS share from a client
Copyright (c) 2010 Servin Corporation
28
Chapter 17. Sharing System Files ●
For this midterm, you can skip most of this chapter. –
●
Q. What do letters NIS mean? –
●
However, know these questions/answers Network Information Service
Q. What is NIS used for? –
Use NIS to share system files such as /etc/passwd so that a single copy of file is used throughout network Copyright (c) 2010 Servin Corporation
29
Chapter 17. Sharing System Files ●
Q. What do letters LDAP mean? –
●
Lightweight Directory Access Protocol
Q. How is LDAP used for? –
Use LDAP to share system files in a manner that is more popular and widely used than NIS ● ●
NIS is UNUX/Linux specific LDAP used in UNX/Linux/Windows world
Copyright (c) 2010 Servin Corporation
30
Chapter 18. Electronic Mail ●
For this midterm, you can skip most of this chapter. –
●
Q. Name the email system that is installed on many Linux distros by default –
●
However, know these questions/answers
sendmail
Q. How to check running status of sendmail? –
service sendmail status Copyright (c) 2010 Servin Corporation
31
Chapter 19. Network Management and Debugging ●
Q. Use this command to see if remote host alive –
●
Q. Use this command to trace a route to a host –
●
ping traceroute
Q. Use this command to display network status, statistics, and other networking info –
netstat Copyright (c) 2010 Servin Corporation
32
Chapter 19. Network Management and Debugging ●
Q. Name a command used to connect to a give port. If on port is given, the command connects to port 23 –
●
telnet HOST PORT
Q. Show how to use the “netcat” command to connect to port 25 on localhost –
nc localhost 25
Copyright (c) 2010 Servin Corporation
33
Chapter 19. Network Management and Debugging ●
Q. Name the command to dump TCP package to the command-line –
●
Q. Name the graphical tools used to display network packets –
●
tcpdump
Wireshark
Q. Show the command to display all open ports on localhost –
nmap localhost Copyright (c) 2010 Servin Corporation
34
Chapter 20. Security ●
For this midterm, you can skip most of this chapter. –
●
Q. What is PAM –
●
However, know these questions/answers Pluggable Authentication Module
Q. Where are PAM configuration files –
/etc/pam.d directory
Copyright (c) 2010 Servin Corporation
35
Chapter 20. Security ●
Q. Show to display SELinux status? –
●
Q. Where is selinux pseudo filesystem? –
●
Sestatus /selinux
Q. Where is main selinux configuration file? –
/etc/sysconfig/selinux
Copyright (c) 2010 Servin Corporation
36
Chapter 20. Security ●
●
Q. Show TWO commands used to display firewall tables –
iptables –list
–
service iptables status
Q. Where is main firewall configuration file? –
●
/etc/sysconfig/iptables
Q. Show how to clear out your firewall –
iptables –flush Copyright (c) 2010 Servin Corporation
37
Chapter 21. Web Hosting ●
For this midterm, you can skip most of this chapter. –
●
Q. How to start web server? –
●
Service httpd start
Q. Where is main web server config file? –
●
However, know these questions/answers
/etc/httpd/config/httpd.conf
Q. Where is default web content? –
/var/www/html directory Copyright (c) 2010 Servin Corporation
38
Lab Exercise ●
Create web service and web page such that accessing localhost displays a “Hello Midterm” message. –
Hint ●
Hello Midterm Hello Midterm Copyright (c) 2010 Servin Corporation
39
Questions/Answers ●
●
Once again, remember that Midterm will be like a job interview –
Written exam portion without any books/notes
–
Hand-on Lab to configure system as requested
Recommendation –
●
Start study TODAY so that by Midterm time you'll be ready!
Questions? Copyright (c) 2010 Servin Corporation
40