Presentation Notes 7
Presentation Notes 7
Presentation Notes 7
Chapter 7: Networking
Va Tech
Local-Area
Network (LAN)
Local-Area
Network (LAN)
UNC
Ethernet:
The most commonly used technology for wired LANs
is currently Ethernet carried over twisted-pair
cables. The twisted pairs of wires help reduce
crosstalk. Ethernet devices can communicate at
several different standard speeds: 10, 100, 1,000 or
10,000 Mbits/sec. Cable is designated Category 5,
5e or 6 depending on its characteristics, with
Category 6 cable being the best quality. Higher
quality cables can more reliably transmit data over
longer distances.
RJ-45
connector
Part 2: Ethernet
MAC Addresses:
Every Ethernet device has a unique 6-byte (48-bit) address,
called a Media Access Control (MAC) address. Typically,
the first 3 bytes of the address identify the network device's
manufacturer, leaving 3 bytes (24 bits) to identify the device
uniquely in that manufacturer's address space.
00 : 1A : A0 : BF : 6B : 5F
(00-FF)
(00-FF)
(00-FF)
Dell, Inc.
(00-FF)
(00-FF)
(00-FF)
Medium
Bob
Alice
Charlie
Bob
Is anybody
talking?
Danny
Charlie
Hi Charlie!
Englebert
Carrier sense,
followed by
transmission.
Danny
Englebert
A Collision!
Alice
Bob
Hi Charlie!
Charlie
Hi Alice!
Alice
Bob
Oops!
Charlie
Oops!
Danny
Englebert
Danny
Englebert
Switches:
These days, most wired LANs don't use a shared
medium any more. Instead, they use Ethernet
switches. A switch can be thought of as a smart
medium that can create dedicated connections
between any two of the devices connected to it.
The switch does this by remembering the MAC
addresses of the devices that are plugged into it.
Hi Charlie!
Charlie
MAC = 00:00:01:23:45:67
Ethernet Switch
co
MAC = 00:00:07:65:43:21
e
nn
on
cti
10
Danny
11
IP Addresses:
Each host on an IP network should have a unique 4-byte (32-bit)
IP address. An IP address uniquely identifies a host on the
Internet. IP addresses are typically expressed in dotted
decimal form, like this:
(0-255)
(0-255)
(0-255)
From
10.0.0.0
172.16.0.0
192.168.0.0
To
Number
10.255.255.255 16777216
172.31.255.255
1048576
192.168.255.255
65536
12
bytes of data.
ttl=64 time=0.367 ms
ttl=64 time=1.01 ms
ttl=64 time=0.326 ms
ttl=64 time=0.275 ms
Ctrl-C
--- 192.168.1.2 ping statistics --4 packets transmitted, 4 received, 0% packet loss, time
2998ms
rtt min/avg/max/mdev = 0.275/0.494/1.011/0.301 ms
Note that a host may simply choose not to respond to ping requests. This is
often done for security reasons. Bad Guys will often look for target computers
15
by pinging, in numerical order, each IP address on a network. Addresses that
don't respond may be ignored.
Who has
192.168.1.2?
Tell
00:00:07:65:43:21.
00:00:07:65:43:21
Hi 00:00:07:65:43:21!
I have 192.168.1.2.
My MAC address is
00:00:01:23:45:67
16
Routers:
But what if the host we want is on a
different network segment? In that case,
a router may respond instead. Routers
connect two or more networks, and know
how to route traffic from one segment to
another.
192.168.1.2
Router
Who has
192.168.1.2?
Tell
00:00:07:65:43:21.
Requests for
192.168.1.* go through
me. My MAC address
is .....
17
00:00:07:65:43:21
HWtype
ether
ether
ether
ether
ether
ether
ether
ether
ether
ether
HWaddress
00:16:3E:3E:8D:00
00:04:75:06:E8:D7
00:04:75:86:EA:5E
00:21:70:DF:23:E0
00:16:76:83:01:AE
00:15:C5:5D:58:72
00:04:75:86:EA:02
00:D0:05:30:78:00
00:D0:05:30:78:00
00:20:AF:69:13:B5
Flags Mask
C
C
C
C
C
C
C
C
C
C
Iface
eth0
eth0
eth0
eth0
eth0
eth0
eth0
eth0
eth0
eth0
18
19
20
List of Names
Note that there should always be an entry for the address 127.0.0.1.
This is a special, reserved, address that will always refer to the local
computer. It's called the loopback address. Many programs use the
name localhost or localhost.localdomain to refer to it.
21
22
Network Interfaces:
To get a list of your computer's network interfaces, use the ifconfig
command. Normally, you'll see at least two interfaces:
[root@demo ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1A:A0:BF:6B:5F
inet addr:192.168.100.2 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::21a:a0ff:febf:6b5f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:78617868 errors:0 dropped:0 overruns:0 frame:0
TX packets:25924911 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:725202911 (691.6 MiB) TX bytes:1837757879 (1.7 GiB)
lo
Interface
IP address
Network mask
Broadcast address
26
Ubuntu:
The configuration file for all interfaces is
/etc/network/interfaces. It looks like this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
There's also a graphical tool for manually
configuring network interfaces. It can be
invoked by typing network-admin.
BUT WAIT! By default, most current distributions use a tool called NetworkManager that
attempts to dynamically and automatically configure all of your network interfaces. You should
only fiddle with the network configuration by hand if NetworkManager fails.
27
Part 5: Ports
28
Ports:
When you talk to a computer on the internet, you can identify a
particular service within that computer that you want to talk to. This
is done by giving a port number in addition to the IP address.
A port number is a number between
myserver.mydomain.org
1 and 65535 (a 16-bit range).
192.168.100.50
Services on a computer listen to
particular ports. You can think of a
Port 80
port number as the address of a
Web Server
(httpd)
service inside a server.
eth0
22
Ssh Server
(sshd)
mypc.mydomain.org
192.168.100.20
137
File Server
(smbd)
29
Dynamic/Private/Ephemeral ports:
Ports 49152-65535 are available for temporary use, or for private
use.
30
22:
80:
443:
25:
20/21:
53:
110:
143:
389:
993:
Ssh
Http
Https
Smtp
Ftp
DNS
Pop3
Imap
Ldap
Imaps
You don't need to remember the numbers. You can usually refer to
them by name. Most applications will look up ports by name, using
the file /etc/services. This file contains a list of port names, their 31
associated numbers, and other information.
34
and established)
Foreign Address
State
PID/Program
0.0.0.0:*
0.0.0.0:*
0.0.0.0:*
0.0.0.0:*
0.0.0.0:*
10.2.2.108:22
10.9.3.3:50071
10.2.1.159:22
10.2.2.107:22
10.2.1.57:2200
127.0.0.1:783
128.143.100.51:22
10.2.1.44:22
10.2.1.105:53651
127.0.0.1:22
10.2.1.114:22
10.2.1.113:22
127.0.0.1:22
LISTEN
LISTEN
LISTEN
LISTEN
LISTEN
ESTABLISHED
TIME_WAIT
ESTABLISHED
ESTABLISHED
ESTABLISHED
TIME_WAIT
ESTABLISHED
ESTABLISHED
TIME_WAIT
ESTABLISHED
ESTABLISHED
ESTABLISHED
ESTABLISHED
354/rpc.statd
3507/portmap
13034/X
5858/cupsd
8305/apcupsd
7491/ssh
5581/ssh
25409/ssh
27818/ssh
11350/ssh
15294/ssh
28866/ssh
7362/ssh
7405/ssh 35
26185/ssh
PID
5581
5872
7362
7405
7491
11350
15294
25409
26185
26190
26192
USER FD
bkw1a 3u
root 3u
bkw1a 3u
bkw1a 3u
bkw1a 3u
bkw1a 3u
bkw1a 3u
bkw1a 3u
nx 7u
root 3u
elvis 3u
TYPE
IPv4
IPv6
IPv4
IPv4
IPv4
IPv4
IPv4
IPv4
IPv4
IPv6
IPv6
DEVICE
16201308
13485
15108847
15109181
15109863
17186056
15137397
15883849
6782492
6782493
6782493
NODE NAME
TCP mypc.mydom.org:38860->print.mydom.org:ssh
TCP *:ssh (LISTEN)
TCP mypc.mydom.org:37956->data.mydom.org:ssh
TCP mypc.mydom.org:47173->tracking.mydom.org:ssh
TCP mypc.mydom.org:37218->memory.mydom.org:ssh
TCP mypc.mydom.org:47548->test.mydom.org:ssh
TCP mypc.mydom.org:42177->test2.mydom.org:ssh
TCP mypc.mydom.org:54874->blarg.mydom.org:ssh
TCP localhost.localdomain:60554->localhost:ssh
TCP localhost:ssh->localhost.localdomain:60554
TCP localhost.localdomain:ssh->localhost:60554
36
38
...And Finally...
39
The End
41
Thanks!