Handbook:MIPS/Installation/Networking/ko

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:MIPS/Installation/Networking and the translation is 100% complete.
MIPS 핸드북
설치
설치 정보
매체 선택
네트워크 설정
디스크 준비
스테이지 3 설치
베이스 시스템 설치
커널 설정
시스템 설정
도구 설치
부트로더 설정
마무리
젠투 활용
포티지 소개
USE 플래그
포티지 기능
초기화 스크립트 시스템
환경 변수
포티지 활용
파일 및 디렉터리
변수
소프트웨어 브랜치 함께 사용하기
추가 도구
꾸러미 저장소 개별 설정
고급 기능
네트워크 설정
시작하기
고급 설정
모듈러 네트워크
무선 네트워크
기능 추가
동적 관리

아마도 바로 동작하겠죠?

시스템을 DHCP 서버가 붙은 이더넷에 연결했다면, 네트워크 설정은 거의 자동으로 이루어집니다. ssh, scp, ping, irssi, wget, links 등, 설치 CD에 들어있는 대부분의 네트워크 관련 명령 역시 바로 동작합니다.

DHCP 사용

DHCP(동적 호스트 설정 프로토콜)은 네트워크 정보(IP주소, 네트워크 마스크, 브로드캐스트 주소, 게이트웨이, 네임서버 등)를 자동으로 받을 수 있게 합니다. DHCP 서버가 네트워크에 있을 때(또는 ISP 서비스 업체에서 DHCP 서비스를 제공할 때)만 동작합니다. 네트워크 인터페이스가 이 정보를 자동으로 받게 하려면, dhcpcd를 사용하십시오:

DHCP requires that a server be running on the same Layer 2 (Ethernet) segment as the client requesting a lease. DHCP is often used on RFC1918 (private) networks, but is also used to acquire public IP information from ISPs.

요령
Official Gentoo boot media runs dhcpcd automatically at startup. This behavior can be disabled by adding the nodhcp argument to the boot media kernel commandline.

If it is not already running, dhcpcd can be started on enp1s0 with:

root #dhcpcd eth0

일부 네트워크 관리자는 시스템에서 사용할 호스트 이름과 도메인 이름을 요구합니다. 이 경우 다음 명령을 사용하십시오:

root #dhcpcd -HD eth0

To stop dhcpcd, -x can be used:

root #dhcpcd -x
sending signal Term to pid 10831
waiting for pid 10831 to exit
See also
Dhcpcd usage

네트워크 시험

A properly configured default route is a critical component of Internet connectivity, route configuration can be checked with:

root #ip route
default via 192.168.0.1 dev enp1s0

If no default route is defined, Internet connectivity is unavailable, and additional configuration is required.

Basic internet connectivity can be confirmed with a ping:

root #ping -c 3 1.1.1.1
요령
It's helpful to start by pinging a known IP address instead of a hostname. This can isolate DNS issues from basic Internet connectivity issues.

Outbound HTTPS access and DNS resolution can be confirmed with:

root #curl --location gentoo.org --output /dev/null

모든 기능이 제대로, 이 장의 나머지를 건너뛰고 바로 다음 단계 설치 과정 (디스크 준비)으로 진행할 수 있습니다.

If curl reports an error, but Internet-bound pings work, DNS may need configuration.

If Internet connectivity has not been established, first interface information should be verified, then:

인터페이스 이름 결정

If networking doesn't work out of the box, additional steps must be taken to enable Internet connectivity. Generally, the first step is to enumerate host network interfaces.

ifconfig의 대안 수단으로 ip 명령을 인터페이스 이름으로 결정하요 사용할 수 있습니다. 다음 예제에서는 ip addr 출력 내용(은 다른 시스템의 내용이며 이전 내용과 조금 다름)을 보여줍니다:

The link argument can be used to display network interface links:

root #ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
4: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff

The address argument can be used to query device address information:

root #ip addr
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff
    inet 10.0.20.77/22 brd 10.0.23.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::ea40:f2ff:feac:257a/64 scope link 
       valid_lft forever preferred_lft forever

The output of this command contains information for each network interface on the system. Entries begin with the device index, followed by the device name: enp1s0.

요령
ifconfig 명령을 사용했을 때 인터페이스가 나타나지 않으면, 동일한 명령에 -a 옵션을 사용해보십시오. 이 옵션은 유틸리티에 시스템에서 발견한 모든 인터페이스의 가동 여부를 표시하도록 강제합니다. ifconfig -a 출력에 내용이 나타나지 않으면 하드웨어에 문제가 있거나 인터페이스 드라이버를 커널에 불러오지 않았음음을 의미합니다. 두 경우는 이 핸드북의 주제 범위를 벗어납니다. #gentoo (webchat)에 지원을 문의하십시오.

이 문서 나머지 과정에서, 핸드북은 동작하는 네트워크 인터페이스를 eth0라 하겠습니다.

유추 가능 인터페이스 이름으로 추세가 이동함에 따라, 시스템에 있는 인터페이스 이름은 이전에 사용하던 eth0 이름 부여 방식과 약간 다를 수 있습니다. 최근 설치 미디어에서는 eno0, ens1, enp5s0와 같은 규칙적인 네트워크 인터페이스 이름을 표시합니다. ifconfig 출력에서 로컬 네트워크와 관련된 IP 주소와 함께 네트워크 인터페이스를 찾아 나타냄을 살펴보십시오.

Optional: Application specific configuration

The following methods are not generally required, but may be helpful in situations where additional configuration is required for Internet connectivity.

선택: 프록시 설정

인터넷을 프록시로 연결했다면 설치 과정에 프록시를 설정해야 합니다. 프록시 설정은 정말 쉽습니다. 프록시 서버 정보를 넣을 변수를 설정하기만 하면 됩니다.

Certain text-mode web browsers such as links can also make use of environment variables that define web proxy settings; in particular for the HTTPS access it also will require the https_proxy environment variable to be defined. While Portage will be influenced without passing extra run time parameters during invocation, links will require proxy settings to be set.

대부분의 경우, 서버의 호스트 이름을 사용하여 변수를 정의하는 것으로 충분합니다. 예제에서는 proxy.gentoo.org라는 프록시 서버와 8080포트를 사용한다고 가정하겠습니다.

참고
The # symbol in the following commands is a comment. It has een added for clarity only and does not need to be typed when entering the commands.

HTTP 프록시(HTTP와 HTTPS 트래픽용)를 설정하려면:

root #export http_proxy="http://proxy.gentoo.org:8080"

프록시에 사용자 이름과 암호가 필요하다면, 변수에 다음 문법을 사용하십시오:

코드 프록시 변수에 사용자 이름/암호 추가
http://username:password@proxy.gentoo.org:8080

Start links using the following parameters for proxy support:

user $links -http-proxy ${http_proxy} -https-proxy ${https_proxy}

FTP 프록시를 설정하려면:

root #export ftp_proxy="ftp://proxy.gentoo.org:8080"

Start links using the following parameter for a FTP proxy:

user $links -ftp-proxy ${ftp_proxy}

RSYNC 프록시를 설정하려면:

root #export RSYNC_PROXY="proxy.gentoo.org:8080"

대안: PPP 사용

If PPPoE is required for Internet access, the Gentoo boot media includes the pppoe-setup script to simplify ppp configuration.

During setup, pppoe-setup will ask for:

  • The name of the Ethernet interface connected to the ADSL modem.
  • The PPPoE username and password.
  • DNS server IPs.
  • Whether or not a firewall is needed.
root #pppoe-setup
root #pppoe-start

In the event of failure, credentials in /etc/ppp/pap-secrets or /etc/ppp/chap-secrets should be verified. If credentials are correct, PPPoE Ethernet interface selection should be checked.

대안: PPTP 사용

PPTP 지원이 필요하다면, 설치 CD에서 제공하는 pptpclient를 사용하십시오. 그러나 우선은 설정이 올바른지부터 확인하십시오. /etc/ppp/pap-secrets 또는 /etc/ppp/chap-secrets 파일을 편집하여 올바른 사용자 이름과 암호 조합이 들어가도록 하십시오:

Edit /etc/ppp/pap-secrets or /etc/ppp/chap-secrets so it contains the correct username/password combination:

root #nano -w /etc/ppp/chap-secrets

다음, 필요한 경우 /etc/ppp/options.pptp를 편집하십시오:

root #nano -w /etc/ppp/options.pptp

모든 조치가 완료되었다면, (options.pptp에 설정할 수 없던 옵션으로) pptp를 실행하여 서버에 연걸하십시오:

root #pptp <server ip>

무선 네트워크 접근 준비

경고
Do not use WEP unless it is the only option. WEP provides essentially no security over an open network.
참고
iw 명령 지원은 아키텍처별로 다릅니다. 명령을 사용할 수 없다면, 현재 아키텍처에서 net-wireless/iw 꾸러미를 사용할 수 있는지 참고하십시오. iw 명령은 net-wireless/iw 꾸러미를 설치하지 않으면 활용할 수 없습니다.

무선 네트워크(802.11)카드를 사용한다면, 무엇보다도 먼저 무선 설정을 해야 합니다. 현제 무선 네트워크 카드의 무선 설정을 보려면 iw 명령을 사용하시면 됩니다. iw를 실행하면 결과는 다음과 비슷합니다:

root #iw dev wlp9s0 info
Interface wlp9s0
	ifindex 3
	wdev 0x1
	addr 00:00:00:00:00:00
	type managed
	wiphy 0
	channel 11 (2462 MHz), width: 20 MHz (no HT), center1: 2462 MHz
	txpower 30.00 dBm

현재 연결 상태를 확인하려면:

root #iw dev wlp9s0 link
Not connected.

또는

root #iw dev wlp9s0 link
Connected to 00:00:00:00:00:00 (on wlp9s0)
	SSID: GentooNode
	freq: 2462
	RX: 3279 bytes (25 packets)
	TX: 1049 bytes (7 packets)
	signal: -23 dBm
	tx bitrate: 1.0 MBit/s
참고
일부 무선 네트워크 카드는 wlp9s0 대신 wlan0또는 ra0 장치 이름을 갖습니다. 정확한 장치 이름을 알아보려면 iplink를 실행하십시오.

대부분 사용자에게 바꾸어야 할 중요한 두가지 항목이 있는데, ESSID(무선 네트워크 이름으로 알려짐)와 경우에 따라 바꿀 WEP 키입니다.

  • 우선 인터페이스 활성화 여부를 확인합니다:
root #ip link set dev wlp9s0 up
  • GentooNode 공개 네트워크로 연결하려면:
root #iw dev wlp9s0 connect -w GentooNode
  • 16진수 WEP 키를 사용하여 연결하려면, 키 값 앞에 d:를 앞에 붙이십시오:
root #iw dev wlp9s0 connect -w GentooNode key 0:d:1234123412341234abcd
  • ASCII WEP 키로 연결하려면:
root #iw dev wlp9s0 connect -w GentooNode key 0:some-password
참고
무선 네트워크를 WPA또는 WPA2로 설정한다면 wpa_supplicant를 사용해야합니다. 젠투 리눅스에서 무선 네트워크를 설정하는 내용을 더 많이 알아보려면 젠투 핸드북의 무선 네트워크 절을 읽어보십시오.

iw dev wlp9s0 명령으로 무선 네트워크 설정을 확인하십시오. 무선 네트워크가 동작한다면, 다음 절(네트워크 용어 이해) 에서 설명하는 IP 수준 네트워크 옵션을 설정하거나 이전에 설명한 net-setup 도구를 사용하십시오.

자동 네트워크 설정

In cases where automatic network configuration is unsuccessful, the Gentoo boot media provides scripts to aid in network configuration. net-setup can be used to configure wireless network information and static IPs.

root #net-setup eth0

net-setup에서는 네트워크 환경에 대한 일부 사항을 질문합니다. 모든 과정이 끝나면 네트워크 연결은 동작해야 합니다. 네트워크 연결 시험 방법은 앞서 언급했습니다. 시험 결과가 긍정적이라면 축하드립니다! 이 절의 나머지 부분을 건너뛰고 디스크 준비로 계속 진행하십시오.

중요
Network status should be tested after any configuration steps are taken. In the event that configuration scripts do not work, manual network configuration is required.

네트워크 용어 이해

If all of the above fails, the network must be configured manually. This is not particularly difficult, but should be done with consideration. This section serves to clarify terminology and introduce users to basic networking concepts pertaining to manually configuring an Internet connection.

요령
Some CPE (Carrier Provided Equipment) combines the functions of a router, access point, modem, DHCP server, and DNS server into one unit. It's important to differentiate the functions of a device from the physical appliance.

Interfaces and addresses

Network interfaces are logical representations of network devices. An interface needs an address to communicate with other devices on the network. While only a single address is required, multiple addresses can be assigned to a single interface. This is especially useful for dual stack (IPv4 + IPv6) configurations.

For consistency, this primer will assume the interface enp1s0 will be using the address 192.168.0.2.

중요
IP addresses can be set arbitrarily. As a result, it's possible for multiple devices to use the same IP address, resulting in an address conflict. Address conflicts should be avoided by using DHCP or SLAAC.
요령
IPv6 typically uses StateLess Address AutoConfiguration (SLAAC) for address configuration. In most cases, manually setting IPv6 addresses is a bad practice. If a specific address suffix is preferred, interface identification tokens can be used.

Networks and CIDR

Once an address is chosen, how does a device know how to talk to other devices?

IP addresses are associated with networks. IP networks are contiguous logical ranges of addresses.

Classless Inter-Domain Routing or CIDR notation is used to distinguish network sizes.

  • The CIDR value, often notated starting with a /, represents the size of the network.
    • The formula 2 ^ (32 - CIDR) can be used to calculate network size.
    • Once network size is calculated, usable node count must be reduced by 2.
      • The first IP in a network is the Network address, and the last is typically the Broadcast address. These addresses are special and cannot be used by normal hosts.
요령
The most common CIDR values are /24, and /32, representing 254 nodes and a single node respectively.

A CIDR of /24 is the de-facto default network size. This corresponds to a subnet mask of 255.255.255.0, where the last 8 bits are reserved for IP addresses for nodes on a network.

The notation: 192.168.0.2/24 can be interpreted as:

  • The address 192.168.0.2
  • On the network 192.168.0.0
  • With a size of 254 (2 ^ (32 - 24) - 2)
    • Usable IPs are in the range 192.168.0.1 - 192.168.0.254
  • With a broadcast address of 192.168.0.255
    • In most cases, the last address on a network is used as the broadcast address, but this can be changed.

Using this configuration, a device should be able to communicate with any host on the same network (192.168.0.0).

The Internet

Once a device is on a network, how does it know how to talk to devices on the Internet?

To communicate with devices outside of local networks, routing must be used. A router is simply a network device that forwards traffic for other devices. The term default route or gateway typically refers to whatever device on the current network is used for external network access.

요령
It's a standard practice to make the gateway the first or last IP on a network.

If an Internet-connected router is available at 192.168.0.1, it can be used as the default route, granting Internet access.

To summarize:

  • Interfaces must be configured with an address and network information, such as the CIDR value.
  • Local network access is used to access a router on the same network.
  • The default route is configured, so traffic destined for external networks is forwarded to the gateway, providing Internet access.

The Domain Name System

Remembering IPs is hard. The Domain Name System was created to allow mapping between Domain Names and IP addresses.

Linux systems use /etc/resolv.conf to define nameservers to be used for DNS resolution.

요령
Many routers can also function as a DNS server, and using a local DNS server can augment privacy and speed up queries through caching.

Many ISPs run a DNS server that is generally advertised to the gateway over DHCP. Using a local DNS server tends to improve query latency, but most public DNS servers will return the same results, so server usage is largely based on preference.

직접 네트워크 설정

Interface address configuration

중요
When manually configuring IP addresses, the local network topology must be considered. IP addresses can be set arbitrarily; conflicts may cause network disruption.

To configure enp1s0 with the address 192.168.0.2 and CIDR /24:

root #ip address add 192.168.0.2/24 dev enp1s0
요령
The start of this command can be shortened to ip a.

Default route configuration

Configuring address and network information for an interface will configure link routes, allowing communication with that network segment:

root #ip route
192.168.0.0/24 dev enp1s0 proto kernel scope link src 192.168.0.2
요령
This command can be shortened to ip r.

The default route can be set to 192.168.0.1 with:

root #ip route add default via 192.168.0.1

DNS configuration

Nameserver info is typically acquired using DHCP, but can be set manually by adding nameserver entries to /etc/resolv.conf.

경고
If dhcpcd is running, changes to /etc/resolv.conf will not persist. Status can be checked with ps x | grep dhcpcd.

nano is included in Gentoo boot media and can be used to edit /etc/resolv.conf with:

root #nano -w /etc/resolv.conf

Lines containing the keyword nameserver followed by a DNS server IP address are queried in order of definition:

파일 /etc/resolv.confUse Quad9 DNS.
nameserver 9.9.9.9
nameserver 149.112.112.112
파일 /etc/resolv.confUse Cloudflare DNS.
nameserver 1.1.1.1
nameserver 1.0.0.1

DNS status can be checked by pinging a domain name:

root #ping -c 3 gentoo.org

Once connectivity has been verified, continue with Preparing the disks.