Tcpip Linux

download Tcpip Linux

of 21

Transcript of Tcpip Linux

  • 8/6/2019 Tcpip Linux

    1/21

    Configuring TCP/IP

  • 8/6/2019 Tcpip Linux

    2/21

    Objectives

    After completing this unit, students should be able to:Configure TCP/IPTest the TCP/IP configuration

  • 8/6/2019 Tcpip Linux

    3/21

  • 8/6/2019 Tcpip Linux

    4/21

    Configure Hostname

    Done with the hostname command# hostname tux

    To configure hostname permanently, configure the

    startup file appropriate for your distributionRed Hat: /etc/sysconfig/networkSuSE: /etc/HOSTNAME

  • 8/6/2019 Tcpip Linux

    5/21

    Configure Adapters

    Most adapters will be autodetected while booting thesystem - no further configuration necessary

    Some complications

    Multiple adaptersSome adapters are not probed correctly

    To configure adapters manually, change

    lilo.conf or grub.conf (if support compiled into kernel)/etc/modules.conf (if support compiled as modules)# cat /etc/lilo.conf.image=/boot/bzImage

    append="eth0=0x300,2,3c509".# cat /boot/grub/grub.conf.title Red Hat Linux (2.4.18-3)

    kernel /vmlinuz-2.4.18-3 ro root=/dev/hda7 eth0=0x300,2,3c509.# cat /etc/modules.confalias eth0 3c509options eth0 io=0x300 irq=2

  • 8/6/2019 Tcpip Linux

    6/21

    Assign IP Addresses

    Done with ifconfig# ifconfig eth0 129.33.151.7 netmask 255.255.255.0 up

    ifconfig without options shows the current configuration

    Make permanent by adding to the configuration filesRed Hat: /etc/sysconfig/networking/devices/ifcfg-SuSE: /etc/sysconfig/network/ifcfg-

    To activate/deactivate an interface manually, using theifcfg- information, use ifup and ifdown# ifup eth0# ifdown eth0

  • 8/6/2019 Tcpip Linux

    7/21

    Configuring Wireless Adapters

    Wireless (IEEE 802.11) adapters are configured likeethernet adapters with a few extra parameters:Link speed (use "auto")SSID (Service Set IDentifier)WEP encryption keys and settings

    Done with iwconfig command:# iwconfig eth1 rate auto essid "IBMEDUC" enc "1234567890"

    Configuration generally stored alongside IP configurationin ifcfg- files

    Can use redhat-config-network or yast to configurewireless parameters

    Other useful commands:iwlist : List information from wireless networkiwspy : Display signal quality and strength

  • 8/6/2019 Tcpip Linux

    8/21

  • 8/6/2019 Tcpip Linux

    9/21

    Configuring the Default Route

    The Default Route is the "way out" of your local networkShould be added to the routing table:# route add default 129.33.151.1

    route without options gives all current routesMake permanent by adding to the configuration files

    Red Hat: /etc/sysconfig/network or /etc/sysconfig/networking/devices/ifcfg- (*)SuSE: /etc/sysconfig/network/routes or /etc/sysconfig/network/ifcfg- (*)

    (*) Configuring a per-device default route is only useful one.g. laptops, where not all devices are used simultaneously

  • 8/6/2019 Tcpip Linux

    10/21

  • 8/6/2019 Tcpip Linux

    11/21

    /etc/hosts

    # The format of the file is:# # comments

    127.0.0.1 loopback localhost

    129.33.151.7 sys7129.33.151.1 sys1 router129.33.151.201 sys201 dns1129.33.151.202 sys202 dns2

  • 8/6/2019 Tcpip Linux

    12/21

    f

  • 8/6/2019 Tcpip Linux

    13/21

    Testing Your Configuration

    Verify local interfacesVerify routing

    Verify ARP table

    Verify connectivity

    Verify hostname resolution

    Verify open ports

    V if L l I f

  • 8/6/2019 Tcpip Linux

    14/21

    Verify Local Interfaces

    # ifconfigeth0 Link encap:Ethernet HWaddr: 00:50:56:81:00:01

    inet addr:129.33.151.7 Bcast:129.33.151.255 Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    RX packets:49 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100interrupt:9 Base address:0x1000

    lo Link encap:Local Loopbackinet addr:127.0.0.1 Mask:255.0.0.0UP LOOPBACK RUNNING MTU:3924 Metric:1RX packets:22 errors:0 dropped:0 overruns:0 frame:0

    TX packets:22 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0

    V if R i

  • 8/6/2019 Tcpip Linux

    15/21

    Verify Routing

    # routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface129.33.151.0 * 255.255.255.0 U 0 0 0 eth0

    default 129.33.151.1 0.0.0.0 UG 0 0 0 eth0

    V if ARP T bl

  • 8/6/2019 Tcpip Linux

    16/21

    Verify ARP Table

    # arp Address HWtype HWaddress Flags Mask Iface

    129.33.151.1 ether 00:A0:24:8A:85:BA C eth0

    V if C ti it

  • 8/6/2019 Tcpip Linux

    17/21

    Verify Connectivity

    # ping 129.33.151.1PING 129.33.151.1 (129.33.151.1) from 129.33.151.7 : 56(84) bytes of data.64 bytes from 129.151.33.1: icmp_seq=0 ttl=255 time=5.0 ms64 bytes from 129.151.33.1: icmp_seq=1 ttl=255 time=0.7 ms64 bytes from 129.151.33.1: icmp_seq=2 ttl=255 time=0.7 ms64 bytes from 129.151.33.1: icmp_seq=3 ttl=255 time=0.7 ms^C--- 129.151.33.1 ping statistics ---4 packets transmitted, 4 packets received, 0% packet lossround-trip min/avg/max = 0.7/1.7/5.0 ms

    Verify Hostname Resolution

  • 8/6/2019 Tcpip Linux

    18/21

    Verify Hostname Resolution

    # host sys7sys7.my_domain.com has address 129.33.151.7# host 129.33.151.77.151.33.129.IN-ADDR.ARPA domain name pointer sys7.my_domain.com

    Verify Open Ports

  • 8/6/2019 Tcpip Linux

    19/21

    Verify Open Ports

    # netstat -a

    Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 *:www *:* LISTENtcp 0 0 *:smtp *:* LISTENtcp 0 0 *:printer *:* LISTEN

    tcp 0 0 *:auth *:* LISTENtcp 0 0 *:finger *:* LISTENtcp 0 0 *:exec *:* LISTENtcp 0 0 *:login *:* LISTENtcp 0 0 *:shell *:* LISTEN

    tcp 0 0 *:telnet *:* LISTENtcp 0 0 *:ftp *:* LISTENudp 0 0 *:ntalk *:*udp 0 0 *:talk *:*raw 0 0 *:icmp *:* 7

    raw 0 0 *:tcp *:* 7

    Checkpoint

  • 8/6/2019 Tcpip Linux

    20/21

    Checkpoint

    1. What is a good first command to use to test whether twohosts can talk to each other on a network?

    2. What command can you use to test for proper nameresolution, both name to address and address to name?

    3. What command will display what is in your arp cache?

    4. What command will show the network status includinginput and output packets transmitted on a networkinterface?

    Unit Summary

  • 8/6/2019 Tcpip Linux

    21/21

    Unit Summary

    To configure TCP/IP the following steps should be takenConfigure adaptersSet a hostnameConfigure IP addressesDefine basic routingConfigure name resolution

    Usually these steps are part of the installation process

    To test your configuration, various commands are useful:ifconfigroutenetstatarpping