User Tools

Site Tools


eg-253:network:step3

Interface Configuration for IP

For illustrative purposes I will describe the configuration of a desktop PC with a static IP address 192.168.x.y using the default gateway 192.168.x.1. You should lookup and make a note of the values to use of x and y for the host you are configuring. These are to be found in Table 2 below. You should replace x and y found in the following by the actual values that you have noted.

Check the Loopback interface

This should already be configured:

<cli> icct@myhost:~$ ifconfig lo lo Link encap:Local Loopback

        inet addr:127.0.0.1  Mask:255.0.0.0
        inet6 addr: ::1/128 Scope:Host
        UP LOOPBACK RUNNING  MTU:16436  Metric:1
        RX packets:11132 errors:0 dropped:0 overruns:0 frame:0
        TX packets:11132 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:1009788 (986.1 KiB)  TX bytes:1009788 (986.1 KiB)

</cli>

Check it works using: <cli> icct@myhost:~$ ping localhost PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.050 ms 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.045 ms 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.048 ms 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=4 ttl=64 time=0.050 ms

— localhost.localdomain ping statistics — 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.045/0.048/0.050/0.005 ms </cli>

Wire up the network

First wire up the network. Power up the hubs and wire up the network so that it matches the physical layout of the map shown in Figure 1 in the our configuration.

  • the first interface (eth0) of each cluster server, the server venus and one of the switched LAN ports on the Linksys router should be connected to the first hub (the hub is essentially the backbone of the icct-net network which as the network address 192.168.1.0).
  • the second interface (eth1) of the jupiter server and each of the hosts in jupiter-net should be connected to the second hub which represents network 192.2.2.0.
  • the second interface (eth1) of the saturn server and each of the hosts in saturn-net should be connected to the second hub which represents network 192.2.3.0.

<note>Note that the cluster servers each have two interfaces. These will be configured as routers from jupiter-net and saturn-net to icct-net and vice versa.</note>

Configure the Ethernet interface on each host

To set up the rest of the network we make use of two basic tools ifconfig and route (see Chapter 4 of Bautts et al., 20051) for general settings and the Network Configuration chapter of the Debian Reference2) for Debian/Ubuntu specific information). We cannot issue these commands from the command line, as implied in Bautts et al., so they have to be set in the special file /etc/network/interfaces. Example settings that you can use are to be found in the example /etc/networking/interface 3).You will be configuring the hosts as shown in Table 2 to which you should refer in the following. Remember that for illustrative purposes I am using the hostname myhost with IP address 192.168.x.y.

Table 2: Static IP Address Settings for Hosts

Host Interface Static IP Address Netmask Gateway Address
venus eth0 192.168.1.2 255.255.255.0 192.168.1.1
jupiter eth0 192.168.1.3 255.255.255.0 192.168.1.1
eth1 192.168.2.1 255.255.255.0 192.168.1.3
callisto eth0 192.168.2.2 255.255.255.0 192.168.2.1
europa eth0 192.168.2.3 255.255.255.0 192.168.2.1
ganymede eth0 192.168.2.4 255.255.255.0 192.168.2.1
saturn eth0 192.168.1.4 255.255.255.0 192.168.1.1
eth1 192.168.3.1 255.255.255.0 192.168.1.4
dione eth0 192.168.3.2 255.255.255.0 192.168.3.1
tethys eth0 192.168.3.3 255.255.255.0 192.168.3.1
titan eth0 192.168.3.4 255.255.255.0 192.168.3.1

To set up your Ethernet interface on a desktop machine you need to convert your settings from DHCP to Static IP addressing. Edit the file /etc/network/interfaces and look for the line which reads:

iface eth0 inet dhcp
auto eth0

Replace this by a configuration of IP address, netmask and gateway based on the following:

auto eth0
iface eth0 inet static
  address 192.168.x.y
  network 192.168.x.0
  netmask 255.255.255.0
  gateway 192.168.x.1

This setting assigns the IP address 192.168.x.y to the first Ethernet interface eth0. From the entries in /etc/hosts, the system knows that an alias of this interface is myhost. The netmask 255.255.255.0 ensures that myhost is made part of the subnet 192.168.x.0 rather than the larger network 192.168.0.0. The gateway setting tells the operating system that any packets that are not for the network 192.168.x.0 should be forwarded through interface 192.168.x.1.

To restart the network with these new settings use: <cli> icct@myhost:~$ sudo /etc/init.d/networking restart </cli>

Now check using sudo ifconfig eth0 and you should see something like:

eth0      Link encap:Ethernet  HWaddr 00:40:D0:2E:EE:6B
          inet addr:192.168.x.y  Bcast:192.168.x.255  Mask:255.255.255.0
          inet6 addr: fe80::240:d0ff:fe2e:ee6b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:302 errors:0 dropped:0 overruns:0 frame:0
          TX packets:753 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:348172 (340.0 KiB)  TX bytes:45775 (44.7 KiB)
          Interrupt:10 Base address:0xe400

From this you should note that the system has changed the IP address and netmask and has automatically set the broadcast address (192.168.x.255). It has also set the Maximum Transfer Unit (MTU) to 1500 bytes which is the largest packet size that Ethernet can carry.

This completes the basic configuration and each desktop host on a subnet should be able to “see” each other. To confirm this, use ping. For example from dione use ping titan to check that the interface on dione can send data to titan. Do the same from titan to dione.

Check the settings by issuing: <cli> icct@myhost:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.x.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.x.1 0.0.0.0 UG 1 0 0 eth0 </cli>


Previous Step | Home | Next Step

1)
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.
2)
Chapter 10 – Network Configuration, Debian Reference, http://www.debian.org/doc/manuals/reference/ch-gateway.en.html.
3)
Example /etc/networking/interface file. Installed in the Ubuntu documentation set in file : /usr/share/doc/ifupdown/examples/network-interfaces.
eg-253/network/step3.txt · Last modified: 2011/01/14 12:59 by 127.0.0.1