네트워크 설정

우분투는 여러분의 네트워크 장치를 설정할 수 있는 몇 가지 그래픽 유틸리티를 제공 합니다. 이 문서는 서버 관리자를 위하여 작성되었고 명령어 라인에서 여러분의 네트워크를 관리하는 것에 중점 합니다.

이더넷

Most ethernet configuration is centralized in a single file, /etc/network/interfaces. If you have no ethernet devices, only the loopback interface will appear in this file, and it will look something like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

If you have only one ethernet device, eth0, and it gets its configuration from a DHCP server, and it should come up automatically at boot, only two additional lines are required:

auto eth0
iface eth0 inet dhcp

The first line specifies that the eth0 device should come up automatically when you boot. The second line means that interface (“iface”) eth0 should have an IPv4 address space (replace “inet” with “inet6” for an IPv6 device) and that it should get its configuration automatically from DHCP. Assuming your network and DHCP server are properly configured, this machine's network should need no further configuration to operate properly. The DHCP server will provide the default gateway (implemented via the route command), the device's IP address (implemented via the ifconfig command), and DNS servers used on the network (implemented in the /etc/resolv.conf file.)

To configure your ethernet device with a static IP address and custom configuration, some more information will be required. Suppose you want to assign the IP address 192.168.0.2 to the device eth1, with the typical netmask of 255.255.255.0. Your default gateway's IP address is 192.168.0.1. You would enter something like this into /etc/network/interfaces:

iface eth1 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1

In this case, you will need to specify your DNS servers manually in /etc/resolv.conf, which should look something like this:

search mydomain.example
nameserver 192.168.0.1
nameserver 4.2.2.2

The search directive will append mydomain.example to hostname queries in an attempt to resolve names to your network. For example, if your network's domain is mydomain.example and you try to ping the host “mybox”, the DNS query will be modified to “mybox.mydomain.example” for resolution. The nameserver directives specifiy DNS servers to be used to resolve hostnames to IP addresses. If you use your own nameserver, enter it here. Otherwise, ask your Internet Service Provider for the primary and secondary DNS servers to use, and enter them into /etc/resolv.conf as shown above.

다이얼업 PPP 인터페이스, IPv6 네트워킹, VPN 장치, 기타 등등을 포함하는 많은 다른 설정들이 가능합니다. 더 많은 정보와 지원되는 선택 사항들은 man 5 interfaces 를 참조 하십시오. 기억해야 할 것은, /etc/network/interfaces 파일은 ifup/ifdown 스크립트에 의하여 사용되고, 그것들은 다른 리눅스 배포판에서 사용되는 것보다 높은 수준의(역주:사용의 편의를 기했다는 의미) 설정 체계 입니다. ifconfig, route, 그리고 dhclient 와 같은 전통적이고, 낮은 수준의(역주:명령어 라인에 직접 입력해야 한다는 의미) 유틸리티는 여전히 ad hoc 설정을 위하여 사용 가능 합니다.

DNS 항목 관리

This section explains how to configure which nameserver to use when resolving IP addresses to hostnames and vice versa. It does not explain how to configure the system as a name server.

DNS 항목을 관리하려면, 여러분은 /etc/resolv.conf 파일에서 DNS 이름을 추가, 편집 또는 삭제할 수 있습니다. 예제 파일이 아래와 같이 주어집니다:

search com
nameserver 204.11.126.13
nameserver 64.125.134.133
nameserver 64.125.134.132
nameserver 208.185.179.218

The search key specifies the string which will be appended to an incomplete hostname. Here, we have configured it to com. So, when we run: ping ubuntu it would be interpreted as ping ubuntu.com.

The nameserver key specifies the nameserver IP address. It will be used to resolve a given IP address or hostname. This file can have multiple nameserver entries. The nameservers will be used by the network query in the same order.

[주의]

If the DNS server names are retrieved dynamically from DHCP or PPPoE (retrieved from your ISP), do not add nameserver entries in this file. It will be overwritten.

[주의]

The changes you make in /etc/resolv.conf will be erased when you reboot your machine. If you want to make this change permanent, you should install resolvconf package from the Universe repository and update the DNS information in the /etc/resolvconf/resolv.conf.d/base file provided by that package.

호스트 관리

호스트를 관리하기 위하여, 여러분은 /etc/hosts 파일에서 호스트를 추가, 편집 또는 삭제할 수 있습니다. 그 파일은 IP 주소와 그에 대응하는 호스트 이름을 가집니다. 여러분의 시스템이 호스트 이름으로 IP 주소를 해결하거나 IP 주소로 호스트 이름을 결정할 때, 그것은 네임서버를 사용하기 전에 /etc/hosts 파일을 참조 합니다. 만약 그 IP 주소가 /etc/hosts 파일 내에 열거되었다면, 네임서버는 사용되지 않습니다. 이 동작은 여러분이 위험을 감수하는 것을 전제로 /etc/nsswitch.conf 파일을 편집하는 것으로 변경될 수 있습니다.

만약 여러분의 네트워크이 DNS에 나열되지 않은 IP 주소를 가지는 컴퓨터들을 가지고 있다면, 그것들을 /etc/hosts 파일에 추가하는 것을 권장 합니다.