Operating System/Solaris2007/08/08 10:48

22장. Network 관련 Technique (&Tip)

22.1 Tuning the system for a web server

System 의 netscape server 를 tuning 한다는 것은 특별히 System이 non web 관련된 작업에 사용될 경우에 critical 할 수가 있다. 다음은 Sun system 에서의 web server 를 구축 시에 고려해야 할 것들이다.

Example of Common settings for Web servers:

/usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_max 10000
/usr/sbin/ndd -set /dev/tcp tcp_ip_abort_interval 60000
/usr/sbin/ndd -set /dev/tcp tcp_close_wait_intercal 60000
/usr/sbin/ndd -set /dev/tcp tcp_keepalive_intercal 300000

/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max 128

*reboot system, or restart httpd.

22.2 Linux Network setup

- Kernel Module을 올릴 때

# modprobe de4x5

- 자동화를 위한 설정 File conf.modules ( /etc/conf.modules)

alias   eth0    de4x5
alias   eth1    de4x5

- Network Interface에 주소 붙이기

# ifconfig eth0 xxx.xxx.xxx.xxx(System IP 주소)

- Network Interface 확인하기

# ifconfig eth0

- Network Interface 죽이기

# ifconfig eth0 down

- Routing Table 만들기

# route add -net xxx.xxx.xxx.0 eth0 또는
# route add -net xxx.xxx.xxx.0

- Routing Table 지우기

# route del -net xxx.xxx.xxx.0

- Gateway 입력하기

# route add default gw xxx.xxx.xxx.xxx(Gateway IP 주소)

22.3 Snoop

Packet을 Monitoring 하기 위한 Utility 이며, 아래는 사용방법이다.

   # snoop -o /tmp/packet_file

          ; packets capture, packet_file 로 저장된다.

   # snoop -i /tmp/packet_file

          ; read packets, 저장된 packet_file을 볼 때 사용.

   # snoop broadcast packets

          ; examine broadcast packets.

   # snoop -v broadcast

          ; print verbose broadcast packet header information

   # snoop -v arp

          ; print verbose ARP packet header information.

   -s 120 ; Packet Header 부분 120 byte만 잡을 때
   -c 100 ; 100개의 Packet만 잡을 때

22.4 Address Resolution Protocol(ARP)

ARP is the process that builds an address link between the Internet(IP) and network interface/hardware layer(Ethernet) layers. It is used by a host to prepare a unit of information for network transmission.

#arp -a

- examine all entries in the ARP table.

#arp hostname

- examine a specific ARP table entry.

#arp -s hostname ether_address

- Add apermanent ARP table entry.

#arp -s hostname ether_address temp

- Add a temporary ARP table entry. This entry will expire after 20 min.

#arp -s hostname ether_address pub

- Add published ARP table entry.

Troubleshooting the in.rarpd Server

- If a diskless client refuses to boot, use the following system startup script to restart any missing processes.

#/etc/init.d/nfs.server start

22.5 ifconfig

#ifconfig -a

- examin the status of all network interface.

#ifconfig interface

where interface is the name le[0-9], ie[0-9], etc.

#ifconfig -a

lo0: flags=849<UP, LOOPBACK, RUNNING, MULTICAST> mtu 8232
      inet 127.0.0.1 netmask ff000000

le0: flags=863<UP, BROADCAST, NOTRAILERS, RUNNING, MULTICAST> mtu 1500
      inet 129.150.182.5 netmask ffffff00 broadcast 129.150.182.255
      ether 8:0:20:b:18:0

* The fields are:

- Interface name

        - Loopback interface (lo0)
         The loopback is used for testing purpose and whenever a host needs to send packet to itself.

        - Other interface names may be le[0-9] or io[0-9].

- Flags

      - UP   : This flag indicates that the interface is marked "up" and will send and receive packets through the interface.
      - DOWN (not shown)
              : Conversely, the interface may be marked "down." When an interface is marked "down," the interface will not pass or forward packet to the host.

      - NOTRAILERS
              : This flag indicates no support for non-standard encapsulation of IP packets on certain link levels.

      - RUNNING
              : The flag means the interface is recognized by the host.

      - MULTICAST
              : This flag indicates the interface supports a multicast address.

      - BROADCAST
                : This flag indicates that the interface supports a broadcast address.

- Maximum transfer unit (MTU)

      For example, mtu 8232, and mtu 1500. The MTU determines packet fragmentation at the network layer.

- Internet address

      For example, inet 129.150.182.5. The internet address is used to respond to and create ARP queries.

- Netmask

      For example, netmask ffffff00. The netmask is applied to incoming and outgoing packets at the network layer.

- Broadcast address

      For example, broadcast 129.150.182.255. The broadcast address is used to send messages to all hosts.

- Ethernet address

      For example, and ether 8:0:20:b:18:0. The Ethernet address is used to respond to and create ARP queries.

22.6 The startup script results in the following

#/usr/sbin/in.routed [-gqsStv] [logfile]

- in.routed is invoked at boot time by the /etc/init.d/inetinit script. It is used to update routing tables. On routers, by default, it broadcasts the routes every 30 second.

#in.routed -q                         

        To start in.routed in quiet mode with the -q option to keep from broadcasting. (router가 아닌 경우)

#in.routed -s

      To make an non-router broadcast as if it were a router
      Softwar적으로 router기능을 setting하고자 하는 경우.

#in.routed -v /var/adm/routelog

      To log the actions of in.routed

- Routers start

      - in.routed -s
      - in.rdisc -r

/etc/init.d/inetsvc

This script initializes the multicast route for address 244.0.0.0. The script executes

the command

route to add a path to this destination. The route command is covered later in this lesson.

#netstat -r; 현재 routing table을 보여준다.

Routing Table :

Destination

Gateway

Flags

Ref

Use

Interface

localhost

localhost

UH

0

2272

lo0

192.9.50.1.0

chesapeake

U

3

562

le0

195.200.200.0

yogi-r

UG

10

1562

le0

193.253.253.0

potato-r

UG

3

562

le0

224.0.0.0

chesapeake

UG

3

0

le0


The fields are :

Destination   The destinaton network or host. This field refercences the file

/etc/inet/networks or /etc/inet/hosts.

Gateway      The host that delivers or forwards the packet.

Flags        The status of this route. This field uses the following flags :

              U      The interface up.
              H      The destination is a host not a network.
              G      The delivery host is another host(an indirect path).
              D      The path is an ICMP redirect entry.

Ref          The reference count indicating the current number of active uses of the route.
Use          The number of packets sent using this route. For the localhost entry it is the number of packets received.
Interface     The interface used to that destination.

22.7 The route Command

The route command allows manual manipulation of the routing table.

# route [-fn] add|delete [host|net] destination [gateway[metric]]
# route add net 195.200.200.0 yogi-r 1      To add a route
# route add net Marketing yogi-r 1          To add a route suing a network name
# route delete net 195.200.200.0 yogi-r      To delete net 195.200.200.0 yogi-r
# route -r                                   To flush the routing table
# route add 224.0.0.0 `uname -n` 0          Add the multicast path for 224.0.0.0
# netstat -r 했을 때

Routing Table:

Destination

Gateway

Flags

Ref

Use

Interface

localhost

localhost

UH

0

139

lo0

203.252.9.25

sun.dct.co.kr

UH

4

635

sl0

129.254.10.0

sun.dct.co.kr

U

2

43

le0

default

203.252.9.25

UG

0

635

 

위에서 default 부분이 없으면, 밑처럼 route add 해준다.

"route add default 203.252.9.25 1"

22.8 Router Configuration

1. Edit the file /etc/hostname.le1(this is assuming device le1) and add a single line entry with the host name on this interface.

      hostname-for-le1

2. Edit the file /etc/inet/hosts and add the new IP address and host name.

      IP-address     hostname-for-le1

3. Perform a reconfigure boot and halt the system to add the second Ethernet card

      #halt
      ok boot -r

4. After the system reboots, verify the new interface parameters.

        #ifconfig -a

in.named daemon is started on the server in the system startup script /etc/init.d/inetsvc. This daemon is started only if the in.named configuration file exists.

22.9 2'nd ethenet 설치

 * Card 설치 시 변경 및 등록해주어야 할 File

      /etc/hostname.le1 새로 생성된 File 편집해서 Rebooting
      /etc/hosts
      /etc/networks
      /etc/netmasks

  1. Vi로 hostname.le1 화일에 2nd Ethernet Card 의 이름을 등록해 준다.
  2. 위에서 등록시킨 이름 및 IP_Addr 를 Host File에 추가시켜 준다.
  3. networks, netmasks File에 추가시켜 준다.
  4. #kill -1 1
     #ping 등록명

      등록명 is alive.     

     #ifconfig -a : le0, le1 확인.

* 4.1.3에서 onboard 상의 le0를 DOWN하고, le1을 기본으로 구성할 때.

    1) /etc/hosts, hostname.le0~? 요구 file 생성 or 편집
    2) 기존 le0는 #ifconfig le0 down 하고, 아래와 같이 추가되는 port Setting.

       ifconfig le1 . . . . broadcast . . .

    3) /etc/rc.boot 파일의 hostname.* 으로 test 하는 부분을 hostname.le1으로 고정하면, system booting 시에 le1만 Check 한다.

22.10 4.1.3 DNS setup Client

1. vi /etc/resolv.conf

   DOMAIN kaeri.re.kr
   nameserver 134.75.97.26 (nanum system IP address 등록)

2. mkdir /var/yp
3. cp /usr/lib/nis.Makefile /var/yp/Makefile

        or

   (CD에서 Makefile 생성)

      mkdir /var/yp
      cd /tmp
      /usr/etc/install/extract_files sr0 root -f ./var/yp/Makefile
      mv ./var/yp/Makefile /var/yp

4. vi /var/yp/Makefile

   #B=-b  #을 제거
   B=     #을 삽입

5. vi /etc/rc.local

   ypxrd line # 삭제

6. /usr/etc/yp/ypinit -m

22.11 SLIP

* slip 띄울 때.

        #cd /etc/rc2.d
        #ls *slip 찾아서 아래 file이 있으면,
        #sh -x /S69slip 이라고 typing
        #ifconfig -a 로 sl0가 떴는지 확인

22.12 SUN ATM 설치 시

/etc/atmconfig
/etc/laneconfig   → 편집, 초기 설치 시 예제 참조
/etc/aarconfig(?)

* IPV값을 Switch 와 같게 ...

22.13 IP Aliasing

① hosts file edit

  1.1.1.7  dct.dct.co.kr   dct loghost → 기존
  1.1.1.8  dct1.dct.co.kr  dct1
  1.1.1.9  dct2.dct.co.kr  dct2 → 추가 IP

② hostname.le0

   hostname.le0:1 → dct1
   hostname.le0:2 → dct2

③ ifcomfig le0:1 inet 1.1.1.8 netmask 0xffffff00 broadcast 1.1.1.255
   ifconfig le0:1 ap

    * le0:2 도 마찬가지로 해줌.

④ Reboot(option)

   boot 하면서 Interface 에 le0, le0:1, le0:2 가 보인다.

Web Hosting 은 → IP Aliasing 후에 Apache Web Server 설치 후 http.conf 편집하면 Virtual host 등록 부분이 있다.
DNS 등록 → Aliase 된 IP 에 대하여 DNS Server에서 Web Hosting에 필요한 Domain을 등록한다.

22.14 Static-Routing example

MEANING OF THIS MEMO:

"제 1회 연구 전산망 Workshop/Tutorial 자료집" p229를 재구성함.
복잡한 network에서의 실제 static route를 잡는 예제로 유용할 것임.

순서: Network 구성도, "werner"의 static routing , "larry"의 static routing

0. Network 구성도

                                     Hill-subnet
    |--------------------------------| 128.20.6
         |①       |②        |③               +-------+ +-------+
    +--------+ +--------+ +-------+             | ceo | | cfo |
    | Hill  | | senate | | house |             +-------+ +-------+
    | router | +--------+ +-------+                 |②       |③
    +--------+                        |------------------------------| 128.20.5
         |                                  |①               Directors-subnet
    +--------+                        +-----------+
    | DC    | +--------+            | Directors |
    | router | | netman |            | router   |
    +--------+ +--------+            +-----------+
         |⑥       |①                     |⑤                                Backbone
  ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ 128.20.1
                                 |③                       |②         |⑦
                           +-----------+              +--------+   le1 |
    +-------+ +-------+  | Marketing |              | R & D |   +--------+
    | moe | | larry |  | router   |              | router |   | werner |
    +-------+ +-------+  +-----------+              +--------+   +--------+
        |③        |②         |①                       |①     le0 |②
    |-----------------------------------| 128.20.3    |--------------------------| 128.20.2
        |                        Marketing-subnet             |④         |③   R&D-subnet
    +--------+                                             +--------+ +---------+
    |////|                                             | wilbur | | orville |
    | Bridge |      +-------+                             +--------+ +---------+
    |////|      | curly |
    +--------+      +-------+
        |              | ②
    |---------------------------| 128.20.4
                    Marketing Annex subnet

1. "werner"의 static routing

 (1) route add

              ┬         ┬ Basic   ┬ route add 127.0.0.1 127.0.0.1 (lo0를 잡음)
              │ Simple │ routing │ route add 128.20.2  127.20.2.2 (le0를 잡음)
              │ routing │          ┴ route add 128.20.1  127.20.1.7 (le1을 잡음)
              │         │
     Full    │         ┴              route add default   128.20.2.1 1 (le0를 잡음)
     routing │
              │                          route add 128.20.3.0 128.20.1.3 1 (le1을 잡음)
              │                          route add 128.20.4.0 128.20.1.3 1 (le1을 잡음)
              │                          route add 128.20.5.0 128.20.1.5 1 (le1을 잡음)
              ┴                          route add 128.20.6.0 128.20.1.6 1 (le1을 잡음)

  (2) routing table

      % netstat -nr

Destination

Gateway

Flags

Refcnt

Use

Interface

127.0.0.1

127.0.0.1

UH

3

0

lo0

128.20.2

128.20.2.2

U

4

95778

le0

default

128.20.2.1

UG

0

0

le0

128.20.1

128.20.1.7

U

4

95778

le1

128.20.3

128.20.1.3

UG

0

0

le1

128.20.4

128.20.1.4

UG

0

0

le1

128.20.5

128.20.1.5

UG

0

0

le1

128.20.6

128.20.1.6

UG

0

0

le1


2. "larry"의 static routing

   route add default    128.20.3.1
   route add 128.20.4.0 larry 0 (Bridge를 다루기 위한 routing)

22.15 C-class netmask 방법

203.240.159.X을 8개 정도의 network으로 subneting할 경우

참고) 16개는 256/16=16  netmask number는 240 (256-16) 즉, 255.255.255.240
       8개는 256/8=32   netmask number는 224 (256-32) 즉, 255.255.255.224
       4개는 256/4=64   netmask number는 192 (256-64) 즉, 255.255.255.192
       2개는 256/2=128  netmask number는 128 (256-128) 즉, 255.255.255.128
       1개는 256/1=256  netmask number는 0  (256-256) 즉, 255.255.255.0

     8개의 subnet인 경우

                   0 -----------31
                   32-----------63
                   64-----------95
                   96----------127
                   128---------159
                   160---------191
                   192---------223
                   224---------255
                    |          |
              loopback NO   broadcast NO

mymy# ifconfig -a

lo0: flags=849 mtu 8232
      inet 127.0.0.1 netmask ff000000

le0: flags=863 mtu 1500
      inet 203.240.159.36 netmask ffffffe0 broadcast 203.240.159.63
                                         |                       |
                               netmask가 224이기 때문    host NO에 따라 변함 (36은 32-63사이에 있음)

22.16 NDD를 이용한 Tuning 변수(Solaris2.x)

. 대부분의 TCP, IP, UDP와 ARP tuning은 ndd 명령을 이용한다. 해당 Driver들에 대한 적절한 변수의 열람을 보려면 다음 예와 같다.

% ndd /dev/arp \?
% ndd /dev/ip \?
% ndd /dev/tcp \?
% ndd /dev/udp \?

. 실제 변수를 Setting하기 위해선 다음 예와 같다.

% ndd -set /dev/ip ip_forwarding 0

. 만약 당신이 매번 Booting시 Setting하기를 원한다면

% cat /etc/rc2.d/S69inet

...

#
# Set configurable parameters.
#

ndd -set /dev/tcp tcp_old_urp_interpretation 1

. 많은 변수들은 다음 2개의 Option을 갖음 : 1 (True) and 0 (False).

 # ndd device variable

I.e.:

# ndd /dev/ip ip_debug

0

. 다음은 변수들의 목록과 설명을 기술하였다.

IP Variables
------------

ip_def_ttl
Determines the default Time To Live value for standard IP packets.
The default value is 255.

ip_forwarding
Determines if the workstation will route packets. This variable can be
one of three selections:

  0    Never forward
  1    Always forward
  2    Only forward when two or more interfaces are up

The default value is 2.

ip_send_redirects

Determines whether the host should send ICMP redirects when it routes

packets. The default value is 1 (True).


TCP Variables
-------------

tcp_close_wait_interval
Despite the misleading name, this variable actually sets the time wait interval (the 2MSL value). The default value is 240000 ms (4 minutes).

tcp_ip_ttl
Determines the default Time To Live for TCP/IP packets. The default value is 255.

tcp_keepalive_interval
Determines how frequently to test if an idle connection is still alive. The default value is 7200000 ms (2 hours).

tcp_mss_def
Determines the Maximum Segment Size for nonlocal packets (i.e., packets to be sent to different networks or subnets). The default value is 536 bytes.

tcp_recv_hiwat
Determines the maximum value of the TCP receive window. The default value is 8192 (8k).

tcp_smallest_anon_port
Determines the smallest TCP port number that may be used for an anonymous connection. The default value is 32768.

tcp_xmit_hiwat
Determines the maximum value of the TCP transmit window. The default value is 8192 (8k).

tcp_xmit_lowat
Determines the minimum value of the TCP transmit window. The default value is 2048 (2k).

UDP Variables
-------------

udp_def_ttl   
Determines the default Time To Live for UDP packets. The default value is 255.

udp_do_checksum
Determines whether checksums should be done for UDP packets. The default value is 1 (True).

udp_recv_hiwat
Determines the maximum value of the UDP receive window. The default value is 8192 (8k).

udp_smallest_anon_port
Determines the smallest UDP port number that may be used for an anonymous connection. The default value is 32768.

udp_xmit_hiwat
Determines the maximum value of the UDP transmit window. The default value is 8192 (8k).

udp_xmit_lowat
Determines the minimum value of the UDP transmit window. The default value is 1024 (1k).

22.17 IP forwarding을 disable(solaris2.x)

DETAIL DESCRIPTION:

ndd parameter중 ip_forwarding에 대해서 이해하여라.

Solaris 2.4 system에서 2개의 network card가 있다고 하자, 하나는 ethernet이고 다른 하나는 fddi card라고 하자. 2개의 network간에 ip forwarding을 disable하기를 원한다. ndd parameter중 ip_forwarding의 값을 알아보자, ndd /dev/ip ip_forwarding를 수행하면 값이 나온다.

다음은 Solaris Machine을 Router로 작동 안되게 하는지를 기술하였다.
------------------------------------------------------------------

. Solaris 2.4 이하 version의 경우

당신의 장비를 multiple-interface machine로 Router로 운용하고 싶지 않다면 /etc/init.d/inetinit을 수정할 필요가 있다. 다음 두 line을 찾아 보아라.

numifs=`ifconfig -au | grep inet | wc -l`
numptptifs=`ifconfig -au | grep inet | egrep -e '-->' | wc -l`

그리고 다음 line에 다음과 같이 추가하라.

numifs=2
numptptifs=0

Reboot하라. 그러면 다음부턴 Packet을 route하지 않을 것이다.

. Solaris 2.5 이상 version의 경우 한결 더 간단하다. 다음과 같이 한 다음 reboot 하라.

% touch /etc/notrouter

. 이상은 2개 이상의 Network card가 있는 Solaris 2.4, Solaris 2.5 에서 각각 Packet을 route하지 않는 장비로 setting 하는 법을 기술하였다. 실제로 이상에서 기술하였던 방법은 rc script에서 예를 들면 다음과 같은 예를 수행하기 위한 것이다.

ndd -set /dev/ip ip_forwarding 0

ip_forwarding의 setting 값을 알아보자.

0       Never Forward
1       Always Forward
2       Only forward when two or more interfaces are up

결과적으로 위의 예에서 묘사한 내용은 ip_forwarding의 값을 1에서 0으로 바꿈으로 routing을 억제하는 것이다.

22.18 Routing 환경

1. 공통 Routing 환경

Routing과 Routing Protocol사이엔 차이점이 있다. 모든 File System이 Data를 Route 하지만 모든 System이 Routing Protocols를 수행하지는 않는다. Routing이란 Routing Table에 내포된 정보에 기초하여 Datagrams를 Forwording 하는 것이다. Routing Protocols는 Routing Tables를 만들 때 사용되는 정보를 교환하는 Programs를 말한다.

Minimal Routing - 모든 다른 TCP/IP Network으로 부터 완전히 고립된 Network만이 Minimal Routing Table은 Network Interface가 구성될 때 "ifconfig"에 의해 만들어 진다. 만약 Network이 다른 TCP/IP Network와 직접적인 접근을 하지 않고 Subnetting을 사용하지 않는다면 이 Minimal Routing Table만이 유일하게 필요하지만 이 같은 고립된 Network은 Unix 환경에서 생각보다 드물다.

Static Routing - 다른 TCP/IP Network과 제한된 숫자의 Gateway를 가지는 Network은 Static Routing 으로 구성할 수 있다. 이 Static Routing은 "route" 명령어를 사용하여 Manually하게 구성된다. Static Routing Table은 Network 변경에 대하여 적응되지 않으므로 Route가 바뀌지 않는 곳에 사용되어야 한다. 그러나 원격 목적지가 오직 하나의 Route로만 닿을 수 있을 때 Static Route가 가장 좋은 선택이다.

Dynamic Routeing - 같은 목적지에 하나 이상의 Route가 가능할 때 Dynamic Routing을 사용해야 할 것이다. Dynamic Routing Table은 Route Protocol에 의해 바뀌어진 정보로부터 만들어진다. 이 Protocol들은 바뀌는 Network상태를 반영하여 Route를 동적으로 적응시킬 수 있는 정보를 분배하기 위해 설계되어 있다. Routing Protocol 복잡한 Routing 상황에 System 관리자 가 할 수 있는 것보다 정확하고 빠르게 다룰 수 있으며 Primary Route 가 동작하지 않을 경우의 Back-up Route로의 교체뿐만 아니라 목적지로의 최선의 Route를 결정할 수 있도록 설계되어 있다. 같은 목적지에 대하여 다중의 Path가 있는 어떠한 Network에서도 Routing Protocol이 사용된다.

Route는 ifconfig, route 명령어에 의한 수작업, Routing Protocol에 의한 동적Routing 중의 어떤 방법을 사용하더라도 Route가 들어가면 모두 Routing Table이 됨.

2. Minimal Routing Table

% netstat –rn

Routing tables

Destination

Gateway

Flags

Refcnt

Use

Interface

127.0.0.1

127.0.0.1

UH

1

132

lo0

128.66.12.0

128.66.12.2

U

26

49041

le0


"ifconfig"에 의해 구성된 Routing Table의 첫 번째의 Entry는 lo0가 비치될 때 만들어진 localhost 대한 loopback route이다. 또 다른 network 128.66.12.0에 대한 route는 le0 interface를 통한다. 128.66.12.2 는 원격 gateway address가 아니고 system의 le0 interface에 할당된 주소이다. 두 개의 entry 모두 "U" (UP)라는 flag를 가진다. 이것은 사용할 수 있는 준비가 되어 있다는 것이다. 또한 entry 모두 flag에 "G"(gateway) flag 가없는데 "G" flag는 remote gateway 를 사용하는 것을 의미한다. "G" flag가 없는 것은 외부 gateway를 통하지 않고 local interface 를 통한 직접적인 route를 의미한다.

loopback route는 "H" (host)flag set도 가지고 있다. 이것은 이 route를 통해서 오직 하나의 host 에만 도달할 수 있다는 것을 의미한다. loopback entry의 destination field를 보면 network 주소가 아닌 것을 알 수 있다. loopback의 network주소는 127.0.0.0이며, 127.0.0.1은 개별적 host인 모든 host table에는 특별한 host route 가 있다. 비록 모든 host table이 이러한 host-specific route를 가진다고 해도 대부분의 route는 network을 route한다. 이것은 routing table의 size를 줄이는데 한 이유가 있다.

위의 sample table을 보면 오직 하나의 network route 128.66.12.0만이 존재 하므로 해당 System은 128.66.12.0 network상의 host들 에게만 통신할 수 있다. 이러한 제한된 routing table은 "ping" 명령어로 쉽게 검증할 수 있다.

"ping"은 ICMP를 이용하여 Echo message를 remote host로 강제적으로 보내고 local host 사이의 통신이 성공임을 나타낸다.

3. Building a Static Routing Table

외부 gateway를 통해 remote host로 도달하려면 routing table에 route가 반드시 더 해져야 한다. "route" 명령어는 routing table에 entry를 수동으로 더하거나 삭제 할 수 있다.

#route add 26.0.0.0 128.66.12.1.1
add net 26.0.0.0 : gateway almond

cf) #route add destination gateway metric

destination address는 IP address, /etc/networks file의 network name 또한 /etc/hosts file의 host name, 그리고 "default"로 명시된다.

대부분의 route가 startup 이전에 추가되므로 IP address가 name보다 많이 사용한다. name service가 없다는 가정하에 routing configuration에 필요한 file은 더 이상 없다 항상 4byte numeric IP address를 사용하며 4byte보다 작으면 "route"가 address를 확장시킨다. 이 결과 우리의 의도와 틀릴 수 있다.

"26"이라고 주어질 경우 어떤 "route"의 구현은 26.0.0.0 이라 확장하며 어떤 것은 0.0.0.26 이라 할 수 있다. "default"가 destination address에 쓰이면 route는 default route를 만듦. default route에 연관된 network address는 0.0.0.0 이며 default route는 destination으로 명시된 route가 없을 경우에 항상 사용된다. 그리고 이것이 우리에게 필요한 유일의 route를 가질 수 있다.

만약 network이 하나의 gateway 만을 가진다면 default route를 사용하여 해당 gateway 를 통하여 remote network을 향한 모든 traffic을 직접적으로 route한다.

route 명령어의 다음 field는 gateway address이다. 이것은 목적지 address로 보내는 data들이 경유할 external gateway의 address이다. 이것은 반드시 직접적으로 network에 연결된 gateway의 address이어야 한다.

route의 마지막 argument는 routing metric이다. 이것은 route를 delete할 때는 사용 되지 않으며 added될 때는 항상 필요하다. 만약 route가 local interface를 통하여 G flag가 setting 되어있지 않으면 metric 이 0 이 되며 metric value가 0 보다 크고 G flag가 setting 되어 route가 설치되어 있으면 해당 gateway address는 external gateway 로 여겨진다. static routing에서 metric의 쓰임은 다른 용도는 없으며 다양한 metric value 의 사용은 dynamic routing에서만 필요하다.

22.19 Auto FTP login

- man netrc 참조.
- www 에서 sun 으로 auto ftp setup

1)sun System에 lsh 라는 account 가 lsh0708 이라는 password 로 계정을 가지고 있다.
2) www 의 자기의 home directory 밑에 .netrc 를 chmod 600 으로 작성

ex)more /home/lsh/.netrc
machine sun login lsh password lsh0708

3) www% ftp sun

Connected to sun.

220 sun FTP server (UNIX(r) System V Release 4.0) ready.
331 Password required for lsh.
230 User lsh logged in.

ftp> quit

Creative Commons License
Posted by BLUEDAY™