day 14 introduction to networking. unix networking unix is very frequently used as a server....

18
Day 14 Introduction to Networking

Upload: sherman-tucker

Post on 01-Jan-2016

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Day 14

Introduction to Networking

Page 2: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Unix Networking• Unix is very frequently used as a server.

– Server is a machine which “serves” some function• Web Server

• FTP Server

• Mail Server

• All of these are examples of network services. – You would most often use them across a network.

Page 3: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Routing• In order for any services to work, Unix must be able

to communicate with its network successfully.– Must have a valid static address– Must have the correct Netmask– Must have a default route set.

• May need additional routes

– Must have valid DNS servers configured.

Page 4: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

IP addresses• To view or set the IP address of your unix system,

you use – ipconfig

• To set the IP address of the first ethernet card you would type:– ifconfig eth0 10.0.0.1

• To see the current settings of your network cards, you would just type:– ifconfig

Page 5: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Netmask• A netmask is necessary to tell your system which

network it is in.– The netmask is set with the command

• ifconfig

– e.g.• ifconfig eth0 10.0.0.1 netmask 255.255.255.0

• You should find the appropriate netmask for your network out before configuring your unix machine.

Page 6: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Default Route• The default route is very important. Without it, your

system will not be able to get to the internet successfully.

• Usually the default route should point to either:– The router which you got from your ISP when you

bought your service.– Your firewall/gateway device.

Page 7: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Seeing your routes• netstat –rn

– This will show you all routes which are currently configured on your system.

• Most of these are built from the default route.

Page 8: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Adding/removing a route• route add –net 192.168.0.0 netmask 255.255.0.0 gw

10.0.0.254

• route add –net default gw 10.0.0.253

• Removing Routes:– route delete –net default– route delete –net 192.168.0.0 netmask 255.255.0.0

Page 9: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Networking Utilities• There are some helpful tools built into Unix to help

you trouble shoot Networking problems.– Ping– Traceroute– nslookup– dig– tcpdump

Page 10: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Configuring DNS resolver• Your system must know how to resolve DNS names

into IP addresses. – It does this by looking up its list of resolvers, and

querying the first one listed.

• The DNS resolvers are stored in:– /etc/resolv.conf

• This has nothing to do with your machine being a DNS server. That’s is totally separate.

Page 11: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Ping• Allows you to see if a remote machine is available

on the internet.– An ICMP echo request is sent to the remote machine.– If that machine it up, it will reply with an ICMP echo

reply.

• Typically you would send a number of requests and see if you get all of the packets back.– This provides data about how reliable your connection is.– Ping also provides round trip time to show network

latency problems

Page 12: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

traceroute• If you believe your internet connection is down,

how can you tell where the problem is?– traceroute sends packets to each router between you and

the destination, requesting that each router reply.– Once a router doesn’t reply, you can tell that is where the

communication brake is.

• You probably want to use the –n option on traceroute most of the time.

Page 13: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

nslookup• So you are trying to get to web sites, and they are all

timing out. Why?

• Perhaps your machine cannot lookup DNS information.– nslookup allows you to see if you can resolve DNS

queries (lookup names in the phone book)– Very often your network connection is setup perfectly,

however you can’t resolve DNS, to you it looks like the internet is down.

Page 14: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Options for nslookup• server

– Specifies which server you wish to ask questions of.• Useful to verify that a particular server is available and serving

the correct information.

• type– Allows you to look up the different types of DNS records

• A, PTR, NS, MX

Page 15: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

dig• Another tool which does basically the same things

as nslookup. However this one ships with BIND.– Gives you more verbose output– Some people find it more intuitive to use.

Page 16: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

tcpdump• Standard packet sniffer, which allows you to see

what traffic is passing by on your segment.– This is very useful for diagnosing network problems,

where packets don’t seem to be getting to a destination, you can watch along the way.

– This also poses a security risk, as any machine on a network can sniff the traffic on that network.

Page 17: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

Seeing what services are running• The command

– netstat –a

• will show you a list of all ports which your computer is currently listening on.– In general you only want it to be listening on ports which

you are trying to run a service on.• More about that later.

• It will also show you a list of all currently connected clients.

Page 18: Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server

inetd.conf• This file specifies which services your machine is

listening for connections on. – As a connection comes in, Linux looks up in this file to

see what daemon should handle the request.– This is how you can prevent your machine from serving

some service.