Handbook:Parts/Networking/Advanced/ko

고급 설정
config_eth0 변수는 인터페이스 설정의 핵심입니다. 인터페이스(eth0) 설정의 하이 레벨 명령 모음입니다. 명령 목록의 각 명령은 순서대로 처리합니다. 인터페이스는 최소한 명령 한개가 동작하면 문제가 없는걸로 간주합니다.

내부 명령 목록은 아래와 같습니다.

명령 처리를 실패하면, 대체 명령을 정의합니다. 대체 명령은 설정 구조와 정확하게 일치합니다.

이 명령을 한데 묶을 수도 있습니다. 실제 사용하는 예제는 다음과 같습니다.

네트워크 의존성
Init scripts in can depend on a specific network interface or just "net". All network interfaces in Gentoo's init system provide what is called "net".

If, in, the rc_depend_strict variable is set to "YES", then all network interfaces that provide "net" must be active before a dependency on "net" is assumed to be met. In other words, if a system has a net.eth0 and net.eth1 and an init script depends on "net", then both must be enabled.

On the other hand, if rc_depend_strict="NO" is set, then the "net" dependency is marked as resolved the moment at least one network interface is brought up.

But what about net.br0 depending on net.eth0 and net.eth1? net.eth1 may be a wireless or PPP device that needs configuration before it can be added to the bridge. This cannot be done in as that's a symbolic link to net.lo.

The answer is to define an  setting in :

That alone, however, is not sufficient. Gentoo's networking init scripts use a virtual dependency called "net" to inform the system when networking is available. Clearly, in the above case, networking should only be marked as available when net.br0 is up, not when the others are. So we need to tell that in as well:

For a more detailed discussion about dependency, consult the section on writing initscripts in the Gentoo Handbook. More information about is available as comments within that file.

변수 이름 및 값
Variable names are dynamic. They normally follow the structure of. For example, the variable  holds the value for dhcpcd options for eth0 and   holds the value for dhcpcd options when any interface connects to the ESSID "essid".

However, there is no hard and fast rule that states interface names must be ethx. In fact, many wireless interfaces have names like wlanx, rax as well as ethx. Also, some user defined interfaces such as bridges can be given any name. To make life more interesting, wireless Access Points can have names with non alpha-numeric characters in them - this is important because users can configure networking parameters per ESSID.

The downside of all this is that Gentoo uses bash variables for networking - and bash cannot use anything outside of English alpha-numerics. To get around this limitation we change every character that is not an English alpha-numeric into an _ (underscore) character.

Another downside of bash is the content of variables - some characters need to be escaped. This can be achieved by placing the \ character in front of the character that needs to be escaped. The following list of characters needs to be escaped in this way:, and.

In this example we use wireless ESSID as they can contain the widest scope of characters. We shall use the ESSID My "\ NET:

The above sets the DNS domain to My "\ NET when a wireless card connects to an AP whose ESSID is My "\ NET.

동작 방법
Network interface names are not chosen arbitrarily: the Linux kernel and the device manager (most systems have udev as their device manager although others are available as well) choose the interface name through a fixed set of rules.

When an interface card is detected on a system, the Linux kernel gathers the necessary data about this card. This includes:
 * the onboard (on the interface itself) registered name of the network card, which is later seen through the ID_NET_NAME_ONBOARD parameter;
 * the slot in which the network card is plugged in, which is later seen through the ID_NET_NAME_SLOT parameter;
 * the path through which the network card device can be accessed, which is later seen through the ID_NET_NAME_PATH parameter;
 * the (vendor-provided) MAC address of the card, which is later seen through the ID_NET_NAME_MAC parameter;

Based on this information, the device manager decides how to name the interface on the system. By default, it uses the first hit of the first three parameters above (ID_NET_NAME_ONBOARD, _SLOT or _PATH). For instance, if ID_NET_NAME_ONBOARD is found and set to eno1, then the interface will be called eno1.

Given an active interface name, the values of the provided parameters can be shown using :

As the first (and actually only) hit of the top three parameters is the ID_NET_NAME_PATH one, its value is used as the interface name. If none of the parameters is found, then the system reverts back to the kernel-provided naming (eth0, eth1, etc.)

구형 방식 커널 이름 사용
설정을 바꾸기 전에 네트워크 인터페이스 커널은 리눅스 커널에서 드라이버를 불러온 순서에 따라 자체적으로 이름을 부여합니다(다른 경우는 알 수 없는 이유 때문일 수도 있음). 이 동작은 부트로더에서 net.ifnames=0 부팅 옵션을 설정하여 활성화할 수 있습니다.

개별 이름 사용
The entire idea behind the change in naming is not to confuse people, but to make changing the names easier. Suppose a system has two interfaces that are otherwise called eth0 and eth1. One is meant to access the network through a wire, the other one is for wireless access. With the support for interface naming, users can have these called lan0 (wired) and wifi0 (wireless - it is best to avoid using the previously well-known names like eth* and wlan* as those can still collide with the suggested names).

Find out what the parameters are for the cards and then use this information to set up a custom own naming rule:

Because the rules are triggered before the default one (rules are triggered in alphanumerical order, so 70 comes before 80) the names provided in the rule file will be used instead of the default ones. The number granted to the file should be between 76 and 79 (the environment variables are defined by a rule start starts with 75 and the fallback naming is done in a rule numbered 80).