====== Host and Network Configuration ====== ===== Default Configuration ===== When you originally installed the Ubuntu operating system, you simply connected your host to a switch which itself was connected to the Linksys ADSL/Cable Router/Switch. The Linksys device acts as a DHCP server providing your host with an IP address (in the range ''192.168.1.100''--''192.168.1.150''). The gateway router acts as your gateway to the Internet with gateway IP ''192.168.1.1''. The router will also have received the IP address of the ISP's name servers. You need to make a note of these. The easiest way to do this is simply to examine and note the content of ''/etc/resolv.conf''. If you need to look them up, connect to the router via the URL http://192.168.1.1/ with a web browser. On the Linksys router the user name will be ''admin'', password ''admin''. The settings, including the router's allocated IP address, and the IP addresses of the default gateway and DNS name servers, will be accessible on the //status// page. ===== Our Configuration ===== We want to arrange a network with a slightly different configuration. This will initially be set up to use static IP addresses. Later, it can be extended to use automatic routing, a pair of real DNS servers and DHCP. The configuration is illustrated in Figure 1. {{eg-253:network:icct-network-map.png?725|ICCT.com netmap}} **Figure 1**: //A Map of the Networking Laboratory Network ''icct.com''// Table 1 summarizes the host, network and interface names that we want to use. Note that all hosts and gateways with prefix 192.168 are private and cannot directly be seen by the Internet((Y. Rekhter, B. Moskowitz, D. Karrenberg, G. J. de Groot, E. Lear, "RFC-1918: Address Allocation for Private Internets", Internet Engineering Taskforce, [[http://www.faqs.org/rfcs/rfc1918.html|RFC-1918]], February 1996.)). IP address ''137.44.152.169'' has been provided by our Internet Service Provider (in this case Swansea University). The gateway router (//solaris//) is the Linksys ADSL/Cable router. All traffic to the Internet is routed from the ICCT network through this one connection. The IP address of the network gateway is ''192.168.1.1''. Network Address Translation (NAT) is used to rewrite packets that originate from the private network so that they appear to originate from ''137.44.152.169''.((Jeff Tyson, "How Network Address Translation Works", howStuffWorks.com. http://computer.howstuffworks.com/nat.htm.))((K. Egevang and P. Francis, "RFC-1631: The IP Network Address Translator (NAT)", Internet Engineering Taskforce, [[http://www.faqs.org/rfcs/rfc1631.html|RFC-1631]], May 1994.)) You might want to consider the implication of this if there is a lot of Internet traffic to or from your network. **Table 1**: //Networks, Hosts and IP addresses// ^ Network ^ Hosts ^ IP Address ^ Comments ^ |''**127.0.0.0**''|all|''127.0.0.1''| loopback address| |''**137.44.152.0**'' | ''en152169.swan.ac.uk'' | ''0137.44.152.169'' | Internet gateway (Internet facing router interface) | |''**192.168.1.0**''| ''**solaris**'' | ''192.168.1.1'' | Internet gateway (private network facing router interface) | | | ''venus'' | ''192.168.1.2'' | Network server (Web, DHCP, NIS, NFS, proxy server, etc.) | | | ''gw-jupiter'' | ''192.168.1.3'' | Domain router interface (for //jupiter// subnet) | | | ''gw-saturn'' | ''192.168.1.4'' | Domain router interface (for //saturn// subnet) | | ''**192.168.4.0**'' | DNS 1 | ''194.168.4.100'' | First DNS server (actually internal to the gateway router) | | ''**192.168.8.0**'' | DNS 2 | ''194.168.8.100'' | Second DNS server (actually internal to the gateway router) | | ''**192.168.2.0**'' | ''**jupiter**'' | ''192.168.2.1'' | Server for //jupiter// cluster. Default gateway. | | | ''callisto'' | ''192.168.2.2'' | Host | | | ''europa'' | ''192.168.2.3'' | Host | | | ''ganymede'' | ''192.168.2.4'' | Host | | ''**192.168.3.0**'' | ''**saturn**'' | ''192.168.3.1'' | Server for //saturn// cluster. Default gateway. | | | ''dione'' | ''192.168.3.2'' | Host | | | ''tethys'' | ''192.168.3.3'' | Host | | | ''titan'' | ''192.168.3.4'' | Host | The set up of the network is described in the next few sections. Much of the material is adapted from Bautts //et al.//, 2005((Tony Bautts, Terry Dawson and Gregor N. Purdy, Linux Network Administer's Guide, 3rd Ed., O'Reilly Media Inc., 2005. The 2nd edition is available online as http://www.oreilly.com/catalog/linag2/book/index.html)). For convenience, in the following I use the name ''myhost'' to represent the hostname of the PC being configured. You should replace ''myhost'' by the hostname of the PC that you are configuring. We will set up your machine from the command line. The procedure is the same whether configuring a server or a desktop system. For desktop systems, some of these settings can be made via the //System->Administration->Networking// menu, nonetheless, we still recommend that you use the command line. You should be logged in as the administrative user (usually //icct//) and for most commands you have to use ''sudo'' and give the administrator password. I omit the password entry in the examples that follow. ===== Configuring a Host ===== ==== Disconnect from the Ethernet ==== Initially you need to disconnect your PC from the network. If you are connected to a switch or a hub, disconnect the cable. We will reconnect once some basic configuration has been done. ==== Check your host name ==== You will have set a host name when you installed your Linux system. To verify this type: icct@myhost:~$ hostname somehostname If you need to change this simply type: icct@myhost:~$ sudo nano /etc/hostname This file consists of a single line which should be ''somehostname''. Change the name to ''myhost'' and save. ==== Configuring your hosts file ==== By default, the file ''/etc/hosts'' is consulted before the network DNS servers on the basis that if a host needs to determine an IP address from a host name, ''/etc/hosts'' will be authoritative for any name request that ''localhost'' needs to make in order to communicate on the local area network. This also means that the same host file must exist on all hosts. Achieving this can be difficult, so it is often the case that for networks with more than a few tens of hosts, you'd consider running your own DNS server. We will use ''/etc/hosts'' to ensure that all the hosts match the names given in **Table 1** above. In a later lab, if we have the time, we will set up DNS on our network so that the network becomes more easily manageable (this will become important when we begin to set up virtual web hosts). To set up ''/etc/hosts'', open the file in //nano// or some other suitable file editor: icct@myhost:~$ sudo nano /etc/hosts The file contents will look something like this: 127.0.0.1 localhost.localdomain localhost myhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Leave the first line as it is (this defines the loopback address ''127.0.0.1'' and a number of aliases for ''localhost'', including the hostname of the PC itself). After editing ''/etc/hosts'' it should look like this (lines beginning with ''#'' are comments): # /etc/hosts -- Hosts file for ICCT Private network # # IP FQDN aliases # 127.0.0.1 localhost.localdomain localhost myhost # 192.168.1.1 solaris.icct.co solaris inet-gateway 192.168.1.2 venus.icct.com venus www # # Jupiter cluster # 192.168.1.3 gw-jupiter.icct.com gw-planets jupiter-if1 192.168.2.1 jupiter.icct.com jupiter jupiter-if2 192.168.2.2 callisto.jupiter.icct.com callisto 192.168.2.3 europa.jupiter.icct.com europa 192.168.2.4 ganymede.jupiter.icct.com ganymede # # Saturn cluster # 192.168.1.4 gw-saturn.icct.com gw-saturn saturn-if1 192.168.3.1 saturn.icct.com saturn saturn-if2 192.168.3.2 dione.saturn.icct.com dione 192.168.3.3 tethys.saturn.icct.com tethys 192.168.3.4 titan.saturn.icct.com titan # # Add other hosts/clusters below here # (we'll use this to add virtual hosts to the web-server in a later # lab exercise) # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Save the file and quit your editor. ===== Configure a Networks File ===== Create a new file ''/etc/networks'' and add the following network aliases: # /etc/networks -- Networks file for the ICCT network icct-net 192.168.1.0 jupiter-net 192.168.2.0 saturn-net 192.168.3.0 # # Add further networks here This file provides convenient symbolic names for the networks that we are configuring. ---- [[eg-253:network:step1|Previous Step]] | [[eg-253:network:home|Home]] | [[eg-253:network:step3|Next Step]]