· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
GentooX86 Handbook_Ko_4-3


1. 모듈러 네트워킹

1.1. 네트워크 모듈

우리가 이제 모듈러 네트워킹 스크립드를 지원한다는 것은 새로운 인터페이스 유형을 위해 쉽게 추가할 수 있고 환경 설정 모듈이 이미 존재하는것과의 호환성을 유지할 수 있다는 의미입니다.

필요한 패키지들이 설치되었을때 모듈들은 기본으로 로드 됩니다. 만약 설치되지 않은 패키지에 대한 모듈을 지정했다면 패키지 설치가 필요하다는 알림 에러메세지를 보게 될 것입니다. 이상적으로, 같은 서비스를 제공하는 둘 이상의 패키지가 설치 되었을 때 그리고 다른 것 그 이상의 어떤 하나를 취할 필요가 있을때 독자여러분은 단지 모듈들의 설정사항만 사용하게 될 것입니다.

유의사항 다른 어떤것이 지정되기 전에는 모든 셋팅은 /etc/conf.d/net에 있습니다.

예제 1-1: 모듈 설정
# Prefer iproute2 over ifconfig
modules=( "iproute2" )

# You can also specify other modules for an interface
# In this case we prefer udhcpc over dhcpcd
modules_eth0=( "udhcpc" )

# You can also specify which modules not to use - for example you may be
# using a supplicant or linux-wlan-ng to control wireless configuration but
# you still want to configure network settings per ESSID associated with.
modules=( "!iwconfig" )

1.2. 인터페이스 핸들러

우리는 두가지 인터페이스 핸들러ifconfig와 iproute2를 바로 제공합니다. 어떤 네트워크 환경설정을 하기 위해 이들중 하나가 필요합니다.

ifconfig 는 현재 젠투 기본사항이고 시스템 프로파일에 포함되어 있습니다. iproute2는 좀더 강력하고 유연한 패키지이지만 기본으로 들어있지 않습니다.

예제 2-1 : iproute2 설치
# emerge sys-apps/iproute2

# To prefer iproute2 over ifconfig if both are installed
modules=( "iproute2" )

ifconfig와 iproute2 둘 다가 매우 유사한 일을 하듯이 우리는 상호간 같이 동작하게 하는 기본 환경설정을 하도록 할 수 있습니다. 예를 들어 아래 제시된 일부코드 둘 은 독자여러분이 사용하고 있는 모듈이 어떤것인지 고려하지 않고 동작합니다.

예제 2-2 : ifconfig와 iproute2 예제
config_eth0=( "192.168.0.2/24" )
config_eth0=( "192.168.0.2 netmask 255.255.255.0" )

# We can also specify broadcast
config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )
config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )

1.3. DHCP

DHCP는 네트워크 정보(IP주소, DNS서버, 게이트웨이 등)를 DHCP 서버로부터 요청함을 의미합니다. 이는 네트워크상에 DHCP서버가 동작한다면, 이것이 단지 DHCP를 사용하여 각각의 클라이언트를 불러내고 이것에 의해 모든 네트워크가 설정됨을 의미합니다. 이외의 DHCP를 사용할 수 있기 전에 이것을 요구한다면 무선랜이나 PPP 또는 다른 것들과 비슷한 네트웍 장치를 위해 DHCP를 설정해야 합니다.

DHCP 는 dhclient, dhcpcd, pump, udhcpc에 의해 제공됩니다. 각각의 DHCP 모듈들은 나름 장단점이 있습니다. 여기 재빨리 훑어 볼 수 있는 것들이 있습니다.

DHCP Module Package Pros Cons
dhclient net-misc/dhcp Made by ISC, the same people who make the BIND DNS software. Very configurable Configuration is overly complex, software is quite bloated, cannot get NTP servers from DHCP, does not send hostname by default
dhcpcd net-misc/dhcpcd Long time Gentoo default, no reliance on outside tools, actively developed by Gentoo Can be slow at times, does not yet daemonize when lease is infinite
pump net-misc/pump Lightweight, no reliance on outside tools No longer maintained upstream, unreliable, especially over modems, cannot get NIS servers from DHCP
udhcpc net-misc/udhcp Lightweight - smallest DHCP client around, made for embedded systems Unproven - no distro uses it by default, cannot define a timeout beyond 3 seconds

만약 하나 이상의 DHCP 클라이언트가 설치되었다면 그들 중 하나를 지정해서 사용해야 합니다. 그게 아니라면, 가능한한 우리는 dhcpcd를 기본으로 사용할 것입니다.

DHCP모듈에 지정 선택사항을 보내기 위해서는 module_eth0="..."을 사용합니다. (사용하고자 하는 DHCP모듈로 모듈을 바꾸자면 dhcpcd_eth0 와 같이 합니다)

상대적으로 이상하기 짝이 없는 DHCP를 시도해보고 만들어봅니다. 우리는 dhcp_eth0변수를 사용하는데 있어 다음 명령들을 지원합니다. 기본적으로는 다음중 그 어떤 것도 지정되어 있지 않습니다.

  • release - 재사용을 위한 IP주소를 갱신합니다.
  • nodns - /etc/resolv.conf를 덮어쓰지 않습니다.
  • nontp - /etc/ntp.conf를 덮어쓰지 않습니다.
  • nonis - /etc/yp.conf를 덮어쓰지 않습니다.

예제 3-1 : /etc/conf.d/net에서의 DHCP 설정 견본
# Only needed if you have more than one DHCP module installed
modules=( "dhcpcd" ) 

config_eth0=( "dhcp" )
dhcpcd_eth0="-t 10" # Timeout after 10 seconds
dhcp_eth0="release nodns nontp nonis" # Only get an address

유의사항 : dhcpcd, udhcpc, pump는 기본적으로 호스트네임을 DHCP서버로 전송하므로 더이상의 것을 정할 필요가 없습니다.

1.4. PPPOE/PPPOA를 이용한 ADSL

우선 우리는 ADSL 소프트웨어를 설치할 필요가 있습니다.

예제 4-1 : ppp패키지 설치
# emerge net-dialup/ppp

유의사항 PPPoA가 필요하다면 baselayout-1.12.x 이상 사용중인지 확인해보세요.

두번째로 PPP에 의해 사용될 이더넷 인터페이스를 위한 PPP net 스크립트를 생성합니다.

예제 4-2 : PPP와 이더넷 스크립트 생성
# ln -s /etc/init.d/net.lo /etc/init.d/net.ppp0
# ln -s /etc/init.d/net.lo /etc/init.d/net.eth0

물론 /etc/conf.d/rc에 RC_NET_STRICT_CHECKING="yes"를 설정합니다.

이제 /etc/conf.d/net 설정이 필요합니다..

예제 4-3 : 기본 PPPoE 설정
config_eth0=( null ) (Specify your ethernet interface)
config_ppp0=( "ppp" )
link_ppp0="eth0" (Specify your ethernet interface)
plugins_ppp0=( "pppoe" )
username_ppp0='user'
password_ppp0='password'
pppd_ppp0=(
       "noauth"
       "defaultroute"
       "usepeerdns"
       "holdoff 3"
       "child-timeout 60"
       "lcp-echo-interval 15"
       "lcp-echo-failure 3"
       noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp
)

depend_ppp0() {
    need net.eth0
}

또한 /etc/ppp/pap-secrets에 암호를 지정할 수 있습니다.

예제 4-4 : /etc/ppp/pap-secrets 견본
# The * is important
"username"  *  "password"

만약 USB모뎀으로 PPPoE를 사용한다면 br2684ctl를 emerge할 필요가 있습니다. 어떻게 설정하는지 자세한 정보를 알려면 /usr/portage/net-dialup/speedtouch-usb/files/README 를 보세요.

중요 : /etc/conf.d/net.example에서 ADSL과 PPP 섹션을 잘 읽어보세요. 여기에는 PPP설정을 하는데 필요할만한 모든 셋팅에 관한 보다 상세한 설명이 많이 있습니다.

1.5. APIPA (Automatic Private IP Addressing)

APIPA는 169.254.0.0-169.254.255.255 범위내에서 인터페이스의 범위내에서 임의의 주소를 arping 하여 여분의 주소를 찾는 것을 시도합니다. 응답이 없는 경우 해당 주소가 인터페이스에 할당된 것입니다.

이는 DHCP서버가 없고 직접적으로 인터넷에 연결할 수 없으며 다른 컴퓨터들이 APIPA 를 사용하는 곳에서만 유용합니다.

APIPA 지원을 위해서는, net-misc/iputils 혹은 net-analyzer/arping 를 emerge 합니다.

예제 5-1 : /etc/conf.d/net에서 APIPA 환경 설정
# Try DHCP first - if that fails then fallback to APIPA
config_eth0=( "dhcp" )
fallback_eth0=( "apipa" )

# Just use APIPA
config_eth0=( "apipa" )

1.6. 본딩

본딩, 트렁킹을 연결하려면 net-misc/ifenslave를 emerge 해야 합니다..

본딩은 네트워크 대역폭을 증가하기 위해 사용됩니다. 두 네트워크카드가 같은 네트워크상에 연결되었다면 이것들을 함께 본딩하여 어플리케이션에서 이를 하나의 인터페이스로 보지만 실제로 두개의 네트워크카드를 쓰도록 할 수 있습니다.

예제 6-1 : /etc/conf.d/net에서 본딩 환경설정
# To bond interfaces together
slaves_bond0="eth0 eth1 eth2"

# You may not want to assign an IP to the bonded interface
config_bond0=( "null" )

# Depend on eth0, eth1 and eth2 as they may require extra configuration
depend_bond0() {
  need net.eth0 net.eth1 net.eth2
}

1.7. 브릿징 (802.1d 지원)

브릿징을 지원하려면 net-misc/bridge-utils를 emerge 해야 합니다.

브릿징은 두 네트워크를 함께 묶을때 사용합니다. 예를 들어 ADSL모뎀을 통해 인터넷으로 연결되는 서버는, 무선 액세스 카드를 통해 다른 컴퓨터로 하여금 ADSL로 연결되게 할 수 있습니다. 두 인터페이스를 함께 묶기 위해 브릿지를 생성할 수 있습니다.

예제 7-1 : /etc/conf.d/net에서의 브릿징 환경설정
# Configure the bridge - "man brctl" for more details
brctl_br0=( "setfd 0" "sethello 0" "stp off" )

# To add ports to bridge br0
bridge_br0="eth0 eth1"

# You need to configure the ports to null values so dhcp does not get started
config_eth0=( "null" )
config_eth1=( "null" )

# Finally give the bridge an address - you could use DHCP as well
config_br0=( "192.168.0.1/24" )

# Depend on eth0 and eth1 as they may require extra configuration
depend_br0() {
  need net.eth0 net.eth1
}

중요 : 어떤 브릿지 설정을 사용하기 위해서는, [http]변수 이름 문서를 참조할 필요가 있습니다.

1.8. 맥 주소

sys-apps/baselayout-1.11.14이상의 패키지를 지니고 있고 특정 맥 주소를 변경하려면 인터페이스의 맥 주소를 변경하기 위해 그 어떤것도 emerge할 필요가 없습니다. 그러나 임의의 맥 주소로 바꿀 필요가 있거나 baselayout버전이 언급된 버전보다 낮을경우 net-analyzer/macchanger를 emerge 하여 이 기능을 사용할 수 있게 해야 합니다.

예제 8-1 : 맥 주소 변경 예제
# To set the MAC address of the interface
mac_eth0="00:11:22:33:44:55"

# To randomize the last 3 bytes only
mac_eth0="random-ending"

# To randomize between the same physical type of connection (e.g. fibre,
# copper, wireless) , all vendors
mac_eth0="random-samekind"

# To randomize between any physical type of connection (e.g. fibre, copper,
# wireless) , all vendors
mac_eth0="random-anykind"

# Full randomization - WARNING: some MAC addresses generated by this may
# NOT act as expected
mac_eth0="random-full"

1.9. 터널링

인터페이스 핸들러가 독자여러분을 위해 이것을 할 수 있으므로 그 어떤것도 emerge할 필요가 없습니다.

예제 9-1 : /etc/conf.d/net에서 터널링 환경설정
# For GRE tunnels
iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"

# For IPIP tunnels
iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"

# To configure the interface
config_vpn0=( "192.168.0.2 peer 192.168.1.1" )

1.10. VLAN(802.1q 지원)

VLAN이 지원되기 위해서는, net-misc/vconfig를 emerge 하세요.

Virtual LAN (가상랜)은 단일 네트워크 세그먼트에 연결된 것과 같이 행동하는 네트워크 장치의 그룹입니다. 비록 그것들이 그렇게 안되어 있다 할지라도 말입니다. VLAN 구성원은 같은 물리절 네트워크를 공유하고 있다 할지라도 같은 VLAN에서의 구성원만 볼 수 있습니다.

예제 10-1 : /etc/conf.d/net에서의 VLAN 환경설정
# Specify the VLAN numbers for the interface like so
# Please ensure your VLAN IDs are NOT zero-padded
vlans_eth0="1 2"

# You can also configure the VLAN
# see for vconfig man page for more details
vconfig_eth0=( "set_name_type VLAN_PLUS_VID_NO_PAD" )
vconfig_vlan1=( "set_flag 1" "set_egress_map 2 6" )

# Configure the interface as usual
config_vlan1=( "172.16.3.1 netmask 255.255.254.0" )
config_vlan2=( "172.16.2.1 netmask 255.255.254.0" )

중요 : 어떤 VLAN 설정을 사용하기 위해서는 [http]변수 이름문서를 참고해볼 필요가 있습니다.


ID
Password
Join
It's later than you think.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-02-22 22:53:48
Processing time 0.0075 sec