Flylib.com

Books Software

 
 
 

Configuring IP Addresses on Interfaces


Configuring IP Addresses on Interfaces

The IP address and subnet mask are required on each network interface in a TCP/IP network. The default gateway is not necessary on a router as it is the default gateway to those switches and devices directly attached to the routers interfaces. A Cisco switch, however, can be configured with a default gateway. The example that follows walks you through configuring an IP address on a Fast Ethernet interface.

When you first connect to the router ”whether from a console cable or a Telnet session ”you are automatically at the User EXEC level, as indicated by a > symbol. Use the enable command to enter the Privilege Exec Mode, which is identified with a # symbol as shown below:

RTR>

enable

RTR#

Privilege Exec mode is where you would use most show and debug commands for troubleshooting. The User Exec Mode does have a very limited number of show commands available. The config terminal commands bring you in to Global Configuration Mode, identified by a (config)# added to the router's prompt. Changes made here affect every interface on the router.

RTR#

config terminal

Next we need to go into Interface Configuration Mode. You do this by using the interface command, followed by the type of interface, then the number of the interface you need to configure. In this case we are configuring the first of two Fast Ethernet Interfaces. On a Cisco router, the first interface is always identified by a zero, the second a one, and so on.

RTR(config)#

interface fastethernet0

Above we see the command to select the interface. Once in Interface Configuration Mode, you will notice the prompt now shows a (config-if)# identifying the new mode. You now need to assign the IP address and subnet mask. To do so, apply the 192.16.1.254 IP address, which becomes the default gateway for the hosts on the network attached to the interface and the Class C subnet mask as shown below.

RTR(config-if)#

ip address 192.16.1.254 255.255.255.0

Above we see the IP address now configured on the interface as 192.16.1.254 with a 24-bit subnet mask. The no shutdown command brings up the interface as shown.

RTR(config-if)#

no shutdown

1w5d: %LINK-5-CHANGED: Interface FastEthernet0,
    changed state to administratively down
1w5d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0,
    changed state to down
1w5d: %LINK-3-UPDOWN: Interface FastEthernet0, changed state to up
1w5d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0,
    changed state to up

The output above shows that the IP address configuration was successful, that the interface and the protocols running on the interface have changed states to "up", and that the interface is operating properly.


DNS (Domain Name System)

DNS is a name resolution protocol that converts hostnames to IP addresses, and vice versa. Its structure is that of a hierarchical database, much like the directory structure of a file system. DNS is the reason you don't have to remember the IP address of every Web site. The DNS database consists of the root domain (".") residing at the top of the hierarchy, and top-level domains directly underneath it (such as .com and .edu). Subdomains follow ( example.com ), which in turn can have other subdomains ( specifics.example.com ). Hostnames are based on this system, where each level is separated by a dot.

DNS servers provide the service for name resolution. When a host needs to resolve a domain name, the DNS server receives a request from the host. If the DNS server has the domain name listed in its table, the server simply replies to the host with the IP address of the domain name. If the domain name is a name outside of your network, the DNS server simply needs to know the address of the root name server on the Internet to which it will forward the request. The root server then filters the request through the appropriate domain beneath it, and so on, until the correct name server is reached and the information about the host is available.

Configuring a Router with DNS Servers

A router can use the services of DNS, as well. Configuring the router with DNS servers is easier than having to set up a table of hostnames. By default, the ip domain lookup command is enabled. When the router can't resolve a hostname, it generates a broadcast to look for a DNS server. This can cost you valuable time when you're in a hurry. To terminate this process rather than wait for the broadcast timeout, you can press Ctrl+Shift+6. When setting up the router to use specific DNS servers for name resolution, use the ip name-server ip-address command. In the following example, using a Cisco 3725, we are assigning three DNS servers; you can see that adding a space and an additional DNS server's IP address allows you to add multiple DNS servers:

RTR(config)#

ip name-server ?

A.B.C.D     Domain server IP address (maximum of 6)
  X:X:X:X::X  Domain server IP address (maximum of 6)
RTR(config)#

ip name-server 206.13.31.12 ?

A.B.C.D     Domain server IP address (maximum of 6)
  X:X:X:X::X  Domain server IP address (maximum of 6)
  <cr>
RTR(config)#

ip name-server 206.13.31.12 206.13.28.12 ?

A.B.C.D     Domain server IP address (maximum of 6)
  X:X:X:X::X  Domain server IP address (maximum of 6)
  <cr>
RTR(config)#

ip name-server 206.13.31.12 206.13.28.12 10.1.2.25

RTR(config)#

The above output shows the successful configuration of three DNS servers on the router. The search order for domain name resolutions is the same order that they are entered.

If you decide to use a hostname table, you have to disable the ip domain lookup command by using the no ip domain lookup command. You must then use the ip host hostname ip - address command to build your hostname table. You can have up to eight IP addresses for a hostname. Depending on the size of your network, making all of these entries may take a fair amount of time. To view the hostnames in the table and their corresponding IP addresses, use the show hosts command as shown:

RTR#

show hosts

Default domain is not set
Name/address lookup uses domain service
Name servers are 206.13.31.12, 206.13.28.12, 10.1.2.25
Codes: u - unknown, e - expired, * - OK, ? - revalidate
       t - temporary, p - permanent
   Host                   Age  Type     Address(es)
*p ns2.cwie.net            **  IP       64.38.192.11
*p ns1.cwie.net            **  IP       64.38.192.10
*t digitalcrawlspaces.com   0  IP       64.38.192.188
*t yahoo.com                0  IP       64.58.79.230  66.218.71.198
RTR#

This output shows the known NS resolved hosts in the routers host table.

DNS Caching and Default Gateways

DNS caching saves time and bandwidth and is, therefore, a process of great value. After a DNS server has resolved a name, it stores this mapping in its cache , making it available the next time the server receives a query for one of the already stored mappings. This means that if a query for a host address has already been resolved, the mapping is already stored and, thus, a query does not need to be made across the network a second time.

The expiration of an entry is set by the time-to-live (TTL) value, which is entered in the domain Start of Authority (SOA) record. This ensures room for new mappings and updates. Information about a particular name might change if the old mapping stayed in the cache too long. As a result, the DNS server would provide the wrong information when queries are made.

Part of a router's job is to send packets to remote networks. The default gateway is utilized when a host needs to send a packet to a host on a network other than its own, for which the router does not have a specific route in its routing table. This manually entered route is also known as the gateway of last resort . If a router has no known route to a destination and no gateway of last resort is configured, the router has no other choice but to drop the packet and notify the sending device that it doesn't know where to send the packet.

Once a packet has been directed to the gateway of last resort, the next router can direct the packet to other gateways, and so on, until it reaches its final destination. The default gateway parameter is an IP address specifying the router interface, on which the gateway is configured.

For hosts to communicate with each other on a TCP/IP network, they have to be configured with several IP addresses, one IP address and subnet mask representing the host itself, a default gateway, DNS servers, and occasionally a Windows Internet Naming Server (WINS). On small networks, having static addresses assigned manually at each workstation or server is no big deal, and coping with those changes on the network that will affect every single machine, such as the default gateway, is relatively easy.