Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.ischool.drexel.edu INFO 320 Server Technology I Week 6 Networking 1INFO 320 week 6.

Similar presentations


Presentation on theme: "Www.ischool.drexel.edu INFO 320 Server Technology I Week 6 Networking 1INFO 320 week 6."— Presentation transcript:

1 www.ischool.drexel.edu INFO 320 Server Technology I Week 6 Networking 1INFO 320 week 6

2 www.ischool.drexel.edu Overview Now we’ll focus on basic networking concepts for servers, and see how they’re implemented in Ubuntu –Networking overview –Interface configuration –Other networking files –Networking programs 2INFO 320 week 6

3 www.ischool.drexel.edu Networking overview 3INFO 320 week 6

4 www.ischool.drexel.edu Why network? Why do we need a network? Networking is a big problem –To solve it, make little problems out of it –That’s why networking is broken into layers, each of which has a designated job –The message an app wants to send is broken into packets and sent across the network 4INFO 320 week 6

5 www.ischool.drexel.edu Networking layers Each layer –Has a specific job to do –Has protocols associated with it –Looks at a certain kind of address See networking summary under INFO 330networking summary 5INFO 320 week 6

6 www.ischool.drexel.edu Networking layers The layers of networking spell out ‘All Turtles Need Less Protection’ * –Application –Transport –Network –Link –Physical * I apologize for this dreadful mnemonic – let me know if you think of a better one! 6INFO 320 week 6

7 www.ischool.drexel.edu Networking protocols TCP and UDP are the transport layer protocols –TCP provides polite reliable delivery, UDP is fast and dumb IP (Internet Protocol, v4 or v6) defines the host addresses –Other network layer protocols define how packets are routed to get to their destination 7INFO 320 week 6

8 www.ischool.drexel.edu Addresses As noted, there are three kinds of networking addresses –The transport layer uses the port number of the receiving process –The network layer uses the IP address of the receiving host (computer) Usually this is the only one we care about –The link layer uses the MAC address of the receiving adapter (e.g. Ethernet interface) 8INFO 320 week 6

9 www.ischool.drexel.edu Addresses Notice that IP and MAC addresses belong to interfaces; each network interface has a fixed MAC address, and is assigned an IP address –Older computers typically only had one interface (e.g. Ethernet) and therefore one IP and one MAC address –Now your computer or router might have both wired and wireless interfaces 9INFO 320 week 6

10 www.ischool.drexel.edu Domain and host names Read names backward –The last part is the Top Level Domain (TLD) (edu, com, gov, uk, etc.) –The next to last part with the TLD makes the domain name (drexel.edu) –The full address of the computer is the host name (www.drexel.edu, www.webmail.google.com) 10INFO 320 week 6

11 www.ischool.drexel.edu Networking and client/server Most protocols use the client/server model –A client process asks a server process for information –The server process usually provides it Notice this is a different kind of “client/ server” from the hardware architecture –Any computer can have client and/or server processes running on it 11INFO 320 week 6

12 www.ischool.drexel.edu Networking apps Key Internet apps include DNS, ARP, DHCP, and NAT DNS (Domain Name Service) converts hostnames (www.drexel.edu) to IP addresses; also looks up email servers –A Berkeley Internet Name Domain (BIND) server implements DNS 12INFO 320 week 6

13 www.ischool.drexel.edu Networking apps –A BIND server is also called a nameserver or DNS server –The command nslookup finds DNS information for a domain name nslookup ubuntu.com ARP (Address Resolution Protocol) translates MAC addresses to IP addresses 13INFO 320 week 6

14 www.ischool.drexel.edu Networking apps DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to computers within a network –If you don’t use this, you have to assign IP addresses manually for each interface NAT (Network Address Translation) allows a network to use local IP addresses that aren’t visible to the outside world 14INFO 320 week 6

15 www.ischool.drexel.edu Interface configuration 15INFO 320 week 6

16 www.ischool.drexel.edu Borrowing from Debian Ubuntu borrows from its Debian heritage in terms of network configuration The primary network configuration file is /etc/network/interfaces –It contains network configuration information for all devices on the system The script /etc/init.d/networking reads /etc/network/interfaces 16INFO 320 week 6

17 www.ischool.drexel.edu /etc/network/interfaces The details of this file are messy – see man 5 interfaces man 5 interfaces –It contains network interface configuration information for the ifup(8) and ifdown(8) commandsifup(8)ifdown(8) –Within this file, comments must start at the beginning of the line with a # –The file consists of zero or more "iface", "mapping", "auto" and "allow-" stanzas 17INFO 320 week 6

18 www.ischool.drexel.edu Loopback interface First let’s allow us to talk to ourselves – the loopback interface –When we want to talk to our own system across the network, the loopback interface prevents us from actually leaving the computer –It’s given a reserved IP address (?) 18INFO 320 week 6

19 www.ischool.drexel.edu Loopback interface The loopback is automatically configured, typically with these ‘stanzas’ in the interface file –auto lo –iface lo inet loopback 19INFO 320 week 6

20 www.ischool.drexel.edu Loopback interface Notice everything’s lower case –lo = name of loopback interface –‘ auto ’ has it brought up automatically on boot –The ‘ iface ’ stanza defines the interface and creates its settings, here to be a loopback ‘Stanzas defining logical interfaces start with a line consisting of the word " iface " followed by the name of the logical interface’ (from the man page) 20INFO 320 week 6

21 www.ischool.drexel.edu inet ? Normal TCP/IPv4 networking uses ‘ inet ’ as the protocol type –If you’re using IPv6, use ‘ inet6 ’ instead –Other options exist, such as ‘ ipx ’ for Novell NetWare If this were 1995, that last reference would make sense to you 21INFO 320 week 6

22 www.ischool.drexel.edu Ethernet interfaces Ok, let’s try something more interesting How about an Ethernet interface? –Ethernet interfaces are typically given names starting with ‘eth’, e.g. eth0, eth1 If we’re configuring it with DHCP our life is easy –auto eth0 –iface eth0 inet dhcp 22INFO 320 week 6

23 www.ischool.drexel.edu Static Ethernet interfaces In contrast, if we want to set up our interfaces manually, we make them static (as in static routing) –iface eth0 inet static – address 10.1.1.10 – netmask 255.255.255.0 – gateway 10.1.1.1 23INFO 320 week 6

24 www.ischool.drexel.edu Gateway address The gateway address is a key concept –It identifies the device you need to contact to get to the rest of the world –It’s also called your first-hop router 24INFO 320 week 6

25 www.ischool.drexel.edu allow- stanzas ‘Lines beginning with "allow-" are used to identify interfaces that should be brought up automatically by various subsytems’ –allow-hotplug eth1 Goes with –ifup --allow=hotplug eth0 eth1 –Which will only bring up eth0 or eth1 if it is listed in an "allow-hotplug" line 25INFO 320 week 6

26 www.ischool.drexel.edu Mapping ‘Stanzas beginning with the word "mapping" are used to determine how a logical interface name is chosen for a physical interface that is to be brought up’ Mapping defines scripts that decide how an interface is to be configured 26INFO 320 week 6

27 www.ischool.drexel.edu Mapping example mapping eth0 script /usr/local/sbin/map-scheme map HOME eth0-home map WORK eth0-work iface eth0-home inet static address 192.168.1.1 netmask 255.255.255.0 iface eth0-work inet dhcp 27INFO 320 week 6

28 www.ischool.drexel.edu ifup and ifdownifup and ifdown? ifup - bring a network interface up ifdown - take a network interface down These commands do just that – take interfaces up (running) or down –ifup eth0=home –Means ‘Bring up interface eth0 as logical interface home ’ Can use on the command line too 28INFO 320 week 6

29 www.ischool.drexel.edu ifup and ifdown? Other examples are simpler; bring up eth0 with –ifup eth0 Or shut down all interfaces with –ifdown -a –How could this command be used to produce a DoS attack? 29INFO 320 week 6

30 www.ischool.drexel.edu Wireless networking There are wireless options that can be included in the interface config file See the wireless man page for gory detailswireless For example, they can specify the SSID and type of networking mode –wireless- –wireless-essid Home –wireless-mode Ad-Hoc 30INFO 320 week 6

31 www.ischool.drexel.edu Restart to apply changes If you change /etc/network/interfaces, restart networking to make the changes active –sudo /etc/init.d/networking restart 31INFO 320 week 6

32 www.ischool.drexel.edu Other networking files 32INFO 320 week 6

33 www.ischool.drexel.edu Other networking files A few more files are important to networking, including –/etc/resolv.conf –/etc/hosts –/etc/services –/etc/protocols 33INFO 320 week 6

34 www.ischool.drexel.edu /etc/resolv.conf This text file is the place where your DNS servers are identified When you get an account with an ISP, you get two DNS server IP addresses This file lists them –nameserver 10.1.1.2 –nameserver 10.1.1.3 DHCP will set this file for you 34INFO 320 week 6

35 www.ischool.drexel.edu /etc/resolv.conf Here you can also specify the local domain name –domain drexel.edu This is appended when you try to go to a local server ‘ myserver ’ it fills out the full host name myserver.drexel.edu 35INFO 320 week 6

36 www.ischool.drexel.edu /etc/hosts This file was used to list all the hosts on the Internet (!) –IP_address hostname [aliases...] DNS made that purpose obsolete (yay!!!) Now it just defines localhost and loopback addresses, but it precedes DNS –Your system will consult this file before DNS! (See /etc/host.conf to prove it) 36INFO 320 week 6

37 www.ischool.drexel.edu /etc/hosts Most systems have a small host table containing the name and address information for important hosts on the local network This is useful when DNS is not running, for example during system bootup 37INFO 320 week 6

38 www.ischool.drexel.edu /etc/hosts example 127.0.0.1 localhost 192.168.1.10 foo.mydomain.org foo 192.168.1.13 bar.mydomain.org bar 146.82.138.7 master.debian.org master 209.237.226.90 www.opensource.org Notice that three of these lines include aliases 38INFO 320 week 6

39 www.ischool.drexel.edu /etc/services /etc/services lists the network services available on your system (e.g. HTTP, FTP, Telnet, etc.), and the port numbers they use In contrast, /etc/protocols lists the TCP/IP protocols supported by your system, and gives a description of each 39INFO 320 week 6

40 www.ischool.drexel.edu Networking programs 40INFO 320 week 6

41 www.ischool.drexel.edu Networking programs We’ll look at a few networking applications –dmesg –ifconfig –netstat –route –ping, finger, who, host, traceroute –wireshark, tcpdump, EtherApe, nagios3 41INFO 320 week 6

42 www.ischool.drexel.edu dmesg A lesser known command is dmesgdmesg The program helps users to print out their bootup messages –A handy diagnostic tool in case something breaks during boot So what does this do? –dmesg > boot.messages 42INFO 320 week 6

43 www.ischool.drexel.edu ifconfig ifconfig can be used to configure network interfaces, but is being replaced by ifup and ifdownifconfig By itself as a command, it gives the status and data about all interfaces or a specific interface –ifconfig –ifconfig eth0 43INFO 320 week 6

44 www.ischool.drexel.edu ifconfig It can set the IP address of an interface –ifconfig eth0 123.45.67.89 Or bring up an interface –ifconfig eth0 up It’s vaguely similar to the Windows command ipconfig (notice the spelling difference!) 44INFO 320 week 6

45 www.ischool.drexel.edu netstat netstat is a very powerful command, with zillions of options to get network status for interfaces, protocols, routes, groups, etc.netstat For example, netstat –rn gives the routing table (-r) with numeric output of IP addresses (-n) The actual routing table is in the file /proc/net/route 45INFO 320 week 6

46 www.ischool.drexel.edu route The route command gives the routing table, or can add or delete entries from it For a given range of IP addresses, a routing table tells which interface a packet needs to use to get there –So the first and last columns are most important here – for a given ‘Destination’, I should ‘Use Iface’ eth0, for example 46INFO 320 week 6

47 www.ischool.drexel.edu Routing table For example, ifconfig and route can be used to define a new Ethernet card, and add it to the routing table –ifconfig eth1 192.168.1.3 –route add 192.168.1.3 dev eth1 47INFO 320 week 6

48 www.ischool.drexel.edu Other networking apps ping tells you if a host is connected to the network finger tells what users are online who and w tell what users are on the local network host gives info about a domain traceroute gives the path to a host 48INFO 320 week 6

49 www.ischool.drexel.edu Packet capture apps Many tools exist to capture packets on the network, and analyze them including –wireshark –tcpdump –EtherApe netstat and nagios3 do network monitoring as well 49INFO 320 week 6

50 www.ischool.drexel.edu References Most of the hyperlinks in this set of notes are to the corresponding man pages for Ubuntu 9.04 Networking Summary, dated October 21, 2009 Glenn BookerNetworking Summary The rest of the information is mostly from (Rankin, 2009) and (Petersen,2009) 50INFO 320 week 6


Download ppt "Www.ischool.drexel.edu INFO 320 Server Technology I Week 6 Networking 1INFO 320 week 6."

Similar presentations


Ads by Google