1992.4.17
SUBJECT: Setting Up Subnets
MEANING OF THIS MEMO:
이 memo는 Sun STB (July 1990)의 p71 article을 번역한 것임.
CONTENTS:
0. Introduction
1. Subnetting Procedures
2. Subnet Detailed Explanations
1) Internet Address Scheme
2) Subnetting
3) Using Non-Byte-Aligned Netmasks
4) Subnetting Do's & Don'ts
5) Support Guidelines
DESCRIPTIONS:
0. Introduction
또한 SunOS Release 4.0.3 을 기준으로 한 것이기에
이후 4.1, 4.1.1의 rc script 들의 network 관련 device handling 에 익숙한 경우는
조금 다른 느낌을 가질 것이다.
하지만 subnet 을 이해하는데는 조금도 지장이 없으리라 생각한다.
1. Subnetting Procedures
1) 새로운 network/subnet topology를 결정
* 몇개의 physical subnet으로 분리할 것인지를 결정
* subnet 간의 router로써 쓰일 machine을 결정
* subnet 상의 host들의 위치를 결정
* IP address의 몇개의 bit가 network number로 쓰일지를 결정 - network class를 결정
보기)
Class B network address : 129.145.0.0
Netmask = 255.255.255.0
netmask = 255.255.255.0
|--------------------------------------------| 129.145.14
| |
| |
ie0 | 14.1 ie0 | 14.2
+--------------+ +-------------+
| snowwhite | | |
------------------ | happy |
| snowwhite-gw | | |
+--------------+ +-------------+
ie1 | 15.1
|
| netmask = 255.255.255.0
|--------------------------------------------| 129.145.15
|
ie0 | 15.2
+--------------+
| |
| dumbo |
| |
+--------------+
2) subnet상의 machine들에 host address를 할당한다.
3) 새로이 할당된 IP address에 맞춰 /etc/hosts file을 변경한다.
* 127.0.0.1 localhost entry는 변경하거나 지워서는 안된다.
* loghost alias는 임의대로 할당 가능하다.
NIS를 사용하지 않는다면 각 machine은 자신의 hostname을 loghost로
alias하여 스스로가 loghost가 될 수 있다.
* 대문자가 hostname에 사용되면 NIS하에선 문제 발생 소지가 있다.
그러므로 hostname은 항상 소문자로 사용하는 것이 좋은 방법이다.
4) NIS가 사용된다면 NIS Master사의 /etc/hosts file이 정확한지, 완성 되었는지를
확인하고 이후 NIS database를 update하시라.
# /var/yp/make hosts ( NIS master상에서 )
5) Diskless Client가 network에 붙어 있는 경우
* 전통적으로 server의 ie0 interface에 client를 attach한다.
second ethernet이 아님을 주의하시라.
* server의 /usr/etc/rarpd가 network interface상에서 수행이 되는지를 확인.
* server의 /tftpboot directory에 hexa화한 client의 IP address로의
symbolic link가 되어 있는지, 그 hexa값은 변화된 IP address에 맞게
변경된었는지 확인.
6) Network Setup : 두 가지 방법
(방법 1)
1. /etc/netmasks
129.145.0.0 255.255.255.0
2. /etc/rc.local
적절한 ifconfig line 있는지 확인
# ifconfig ie0 hostname netmask +
3. gateway machine에서는 /etc/rc.local에 추가되는 network interface에
대한 ifconfig line이 adding되어야 한다.
# ifconfig ie1 hostname netmask +
4. NIS를 사용한다면, /etc/netmasks가 정확한 information을 반영하는지
확인한 후 NIS database를 update한다.
# /var/yp/make metmasks
(방법 2)
1. 방법 1 을 사용하여 어떤 문제들이 발생한다면,
/etc/rc.local의 ifconfig line을 comment out하고
/etc/rc.boot의 명시된 ifconfig entry를 대신 사용할 수 있다.
아래의 example서 /etc/rc.boot의 #을 빼고 /etc/rc.local에 #을 놔둔다.
2. snowwhite 상에서.
/etc/rc.boot :
# ifconfig ie0 $hostname -trailers up netmask 255.255.255.0
# ifconfig ie1 snowwhite-rt -trailers up netmask 255.255.255.0
/etc/rc.local :
# ifconfig ie0 $hostname netmask +
# ifconfig ie1 snowwhite-rt netmask +
3. happy 상에서.
/etc/rc.boot :
# ifconfig ie0 $hostname -trailers up netmask 255.255.255.0
/etc/rc.local :
# ifconfig ie0 $hostname netmask +
7) Reboot all machimes
8) IP address,netmask,broadcast address 가 interface type을 가진
ifconfig command의 argument로 정확히 사용되는지를 check한다.
2. Subnet Detailed Explanations
1) Internet Address Scheme
* subnet은 단일 Internet network의 논리적 subsection이므로 subnetting을 이해하기 위해선
먼저 Internet addressing scheme 을 이해할 필요가 있다.
* 모든 site는 고유의 Internet number를 갖게 된다.
이 number는 SRI의 NIS(Network Information Center)에서 할당되고 관리된다.
* IP address는 network address 와 host number라는 두 부분으로 구성되며
32 bit number로 표현된다.
IP address의 format은 period로 구분된는 4개의 field로 구분된다.
각 field는 8 bit로 10진수를 표현한다.
* IP address는 3개의 class로 표현된다.
* Class A:
첫번째 field가 network address이고 나머지 세 개의 field가 host address를 표현한다.
각 field의 범위는
[1-127].[0-254].[0-254].[1-254]
127.0.0.1의 binary 표현: 01111111.00000000.00000000.00000001
network address = 127
host address = 0.0.1
127 network address는 실제로 특정 목적을 위해 사용한다.
SunOS는 이를 loopback interface address로 사용한다.
* Class B:
첫번째 두 field는 network address이고 나머지 두 field는 host address이다.
각 field의 범위는
[128-191].[1-254].[0-254].[1-254]
129.25.10.2의 binary 표현: 10000001.00011001.00001100.00000010
network address = 129.25
host address = 10.2
* Class C:
첫번째 세 field는 network address이고 나머지 한 field는 host address이다.
각 field의 범위는
[192-254].[1-254].[1-254].[1-254]
192.9.200.11의 binary 표현: 11000000.00001001.11001000.00001011
network address = 192.9.200
host address = 11
* 첫 두 bit 는 address class를 결정한다.
01 - class A
10 - class B
11 - class C
* IP broadcast address는 0 나 255 의 address number를 사용한다.
* network address로 사용되는 field나 last host address byte가
0 이나 255 가 되어서는 안된다.
* 잘못 할당된 IP address
0.0.10.1 (network field에 0)
255.0.10.1 (network field에 255)
192.9.200.0 (last host field에 0)
192.9.200.255 (last host field에 255)
2) Subnetting
* subnetting은 admin이나 technical한 이유로
단일 Internet network를 보다 작은 network(subnets)로 분리하는 작업이다.
* 공식적인 Internet number를 얻는 것이 어렵기 때문에,
subnetting은 공식적인 network address 범위를 넘어
network address를 늘리는 방법으로 사용된다.
Class C nets 를 subnetting하는 것은 매우 드문 경우임을 주의 하시라.
* 대단위 network에서의 subnetting은
routing을 매우 효과적으로 또 administration을 매우 쉽게 할 수 있게끔 한다.
좋은 예가 telephone network이다. 전화번호는 지역 코드에 따라 분류되며
이 코드로 특정 전화번호를 그 장소에 정확히 routing하게된다.
* subnetting 은 32 bit netmask 를 사용하여 수행된다.
netmask는 IP address를 AND-ed하여 network number를 만든다(mask off한다).
예를 들어 255.255.255.0 같은 netmask는 아래 보여지는 IP address에 대해 첫 세 field를 mask off
즉 network number로 만든다.
IP address : 11000000.00001001.11001000.00001011
netmask : 11111111.11111111.11111111.00000000
perform logical 'and' : -----------------------------------
network address : 11000000.00001001.11001000.00000000
이는 Class C address에 대한 default netmask이다.
Class A address에 대한 default netmask는 255.0.0.0 다.
Class B address에 대한 default netmask는 255.255.0.0 다.
그리고 다른 subnet mask가 set 된다면, system은 자동적으로 이 default값들을 사용한다.
* 보통 자신의 Class에 의해 결정되는 network address 에 대해 더 많은 bits를 사용하고자 한다면,
즉 자신의 Class에서 허용된 network number의 최대 갯수 이상을 사용하고자 한다면,
default와는 다른 netmask를 사용하여 subnetting을 수행하여야 한다.
* subnetting example :
address 24 인 Class A network 이 있다고 가정하자. host number 가 11 이라면 이 network에서의
IP address는 24.0.0.11이 된다.
|--------------------------------------------| 24
ie0 | ie0|
| 0.0.11 | 0.0.15
+--------------+ +-------------+
| | | |
| happy | | doc |
| | | |
+--------------+ +-------------+
이 network을 두 개로 분리하고자 한다.
우선 router machine을 통해 두 개의 서로 다른 physical로 분리한다.
router machine 의 ie0, ie1 각각에 두 개의 subnet을 연결한다.
첫 8 bits 는 공식적으로 할당된 network number 인 24로 setting 된다.
이 network address에서 위의 두 subnet에 대응하는
두 개의 network number를 얻기 위해서는 host number 에 할당된 field에서
몇 개의 bit를 사용할 필요가 있다.
Class A 에 대한 일반적인 subnet mask 는 255.255.0.0로서
복수개의 network address 를 얻기 위해서 두 번째 field를 사용 한다.
netmask = 255.255.0.0
|--------------------------------------------| 24.10
| |
| |
ie0 | 10.0.1 ie0 | 10.0.2
+--------------+ +-------------+
| snowwhite | | |
------------------ | doc |
| snowwhite-gw | | |
+--------------+ +-------------+
ie1 | 11.0.12
|
| netmask = 255.255.0.0
|--------------------------------------------| 24.11
|
ie0 | 11.0.8
+--------------+
| |
| happy |
| |
+--------------+
3) Using Non-Byte-Aligned Netmasks
* netmask setting 은 일반적으로
byte-aligned field boundary (i.e. 255.255.0.0 나 255.255.255.0) 방식을 사용한다.
하지만 netmask 에 사용되는 bit 수는 byte-aligned boundary를 초과할 수 있다.
한 예로 network address의 첫 21 bits를 subnet mask로 사용한 경우이다.
255.255.248.0 in binary: 11111111.11111111.11111000.00000000
* 위의 예에서 처럼 non-byte-aligned netmask 를 사용할 경우 주의할 점이 있다.
예를 들어 Class B address 129.145.0.0 에 대해 위의 netmask를 사용하고
subnet 으로 129.145.8 와 129.145.9 를 선택한다면
다음과 같은 bit configuration을 얻는다.
129.145.8 10000001.10010001.00001000.00000000
apply the netmask: 11111111.11111111.11111000.00000000
resulting network address: 10000001.10010001.00001
129.145.9 10000001.10010001.00001001.00000000
apply the netmask: 11111111.11111111.11111000.00000000
resulting network address: 10000001.10010001.00001
network address 가 결과적으로 같음에 주목하시라.
이는 당연히 routing 에 문제를 발생시킨다.
* 따라서 netmask에 의해 masking 되는 bits 에 포함될 network address를 선택할 때는
주의를 요한다.
다음은 위 예에서 보여준 다섯 개의 high-order bits 이다.
nnnnnnnn.nnnnnnnn.ssssshhh.hhhhhhhh
129.145.24 10000001.10010001.00011000.00000000
129.145.56 10000001.10010001.00111000.00000000
129.145.32 10000001.10010001.00100000.00000000
4) Subnetting Do's & Don'ts
1. 일관된 subnet masking을 사용하시라.
subnetting에 있어 한 규칙은
동일 network class를 가진 subnet은 netmask가 같아야 한다는 점.
< 잘못된 configuration >
netmask = 255.255.255.0
|----------------------------------------| 24.10.3 <-----+
| | |
| | |
ie0 | 24.10.3.1 ie0 | 24.10.3.2 |
+--------------+ +-------------+ |
| snowwhite | | | 동일 nework class 의 subnet을
------------------ | doc | 다른 netmasking 한 경우
| snowwhite-gw | | | |
+--------------+ +-------------+ |
ie1 | 24.11.0.12 |
| |
| netmask = 255.255.0.0 |
|--------------------------------------------| 24.11 <-----+
|
ie0 | 24.11.0.8
+--------------+
| |
| happy |
| |
+--------------+
< 올바른 configuration >
netmask = 255.255.0.0
|--------------------------------------------| 24.10 <-----+
| | |
| | |
ie0 | 24.10.0.1 ie0 | 24.10.0.2 |
+--------------+ +-------------+ |
| snowwhite | | | 서로 다른 nework class 의 subnet을
------------------ | doc | 다른 netmasking 한 경우
| snowwhite-gw | | | |
+--------------+ +-------------+ |
ie1 | 129.145.2.10 |
| |
| netmask = 255.255.255.0 |
|-------------------------------------------| 129.145.2 <---+
|
ie0 | 129.145.2.8
+--------------+
| |
| happy |
| |
+--------------+
2. 동일한 physical network에 subnet들을 만들지 마시라.
* subnet은 router machine에 의해 physical하게 분리되어야 한다.
두 subnet은 동일 physical한 network에 섞여 있어서는 안된다. 아래의 예는 잘못된 것이다.
netmask = 255.255.0.0
|--------------------------------------------------------------------| 24
ie0 | ie0| ie0 |
| 10.0.11 | 11.0.15 | 11.0.16
+--------------+ +-------------+ +--------------+
| | | | | |
| happy | | doc | | sleepy |
| | | | | |
+--------------+ +-------------+ +--------------+
* 이 경우 24.10 과 24.11 이 동일 cable 위에 놓일 수는 없는 것. 이 경우는 routing을
복잡하게 하여 결국 subnetting은 실패하게 된다.
5) Support Guidelines
* subnetting의 개념과 일반적인 IP address를 사용하여 subnet하는 방법을 확실히 하시라.
정확히 구성되지 않은 subnet environment는
network-based services에 아주 심각하고 직접적인 결과를 초래할 수 있기 때문이다.
* 때때로 subnet상의 machine 간에 통신이 안되는 경우가 발생한다.
가장 흔한 것이 sunnet masks를 잘 못 setting함으로써
여러 subnet상의 machine 들과 통신하는데 어려움을 겪는 경우이다.
이 경우는 OS를 re-install하고 overwritten된
/etc/netmasks, /etc/rc.local, /etc/rc.boot file의 netmask관련 부분을
edit하지 않았을 때 자주 발생한다.
여타 subnet상의 다른 system을 찾을 때 나타나는 error message는 다음과 같을 것이다.
Send to: Network is unreachable
Connection timed out
* 여러 subnet상의 system들과 network에 문제가 있다면 다음을 check해 보시라.
1. netstat로 현재의 routing table을 check하시라.
예를 들어 subnet mask가 잘 못 setting되어 있다면 아래와 같은 결과를 볼 것이다.
# netstat -rn
Routing tables
Destination Gateway Flags Refcnt Use Interface
127.0.0.1 127.0.0.1 UH 1 91 lo0
127.145.0.0 129.145.19.7 UGH 0 0 le0
subnet mask가 제대로 setting되었다면 아래와 같은 결과를 볼 수 있다.
# netstat -rn
Routing tables
Destination Gateway Flags Refcnt Use Interface
192.9.66.1 129.145.19.1 UGH 0 0 le0
192.9.44.1 129.145.19.1 UGH 0 0 le0
127.0.0.1 127.0.0.1 UH 1 91 lo0
192.9.44.2 129.145.19.1 UGH 0 0 le0
2. 만약 routing table이 없다면 ifconfig로 check해 보시라.
# ifconfig le0
le0: flags=63
inet 129.145.19.7 netmask ffff0000 broadcast 129.145.19.0
위의 경우는 default class B subnet mask 즉 ffff0000가 setting되어 있지만
실제로는 nondefault mask가 setting되어야 하는 경우인지를 check해 보아야 한다.
3. subnet mask가 setting되어 있지 않다면,
1. Subnetting Procedures의 step 6 을 수행하고 reboot하시라.
정보가 더 필요하시다면
Systm and Network Administration (Part Number 800-1733)의
Chapter 12. Setting up Subnets page 302-304를 보시라.
Revision History
Updated on Nov. 16 ,1992