3.3.8. nmcli를 사용하여 정적 이더넷 연결 추가 및 구성
정적 이더넷 연결 추가
정적
IPv4 구성으로 이더넷 연결을 추가하려면 다음을 수행합니다. nmcli connection add type ethernet con-name connection-name ifname interface-name ip4 address gw4 address
ip 6 및 gw6 옵션을 사용하여 IPv 6 주소 및 게이트웨이 정보를 추가할 수 있습니다.
예를 들어
선택적으로 장치의
IPv4 주소 및 게이트웨이만 사용하여 정적 이더넷 연결을 생성하려면 다음을 수행합니다.
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254
IPv6 주소 및 게이트웨이를 동시에 지정합니다.
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254 ip6 abbe::cafe gw6 2001:db8::1
Connection 'test-lab' (05abfd5e-324e-4461-844e-8501ba704773) successfully added.
두 개의
이렇게 하면 이전에 설정한
이렇게 하면 이전에 설정한
IPv4 DNS 서버 주소를 설정하려면 다음을 수행합니다.
~]$ nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"
DNS 서버가 모두 교체됩니다. IPv6 DNS 서버 주소 두 개를 설정하려면 다음을 수행합니다.
~]$ nmcli con mod test-lab ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
DNS 서버가 모두 교체됩니다. 또는 이전 세트에 다른 DNS 서버를 추가하려면 + 접두사를 사용합니다.
~]$ nmcli con mod test-lab +ipv4.dns "8.8.8.8 8.8.4.4"
~]$ nmcli con mod test-lab +ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
새 이더넷 연결을 열려면 다음을 수행합니다.
장치 및 연결의 상태를 검토합니다.
~]$ nmcli con up test-lab ifname ens9
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected my-office
ens9 ethernet connected test-lab
lo loopback unmanaged --
새로 구성된 연결에 대한 자세한 정보를 보려면 다음과 같이 명령을 실행합니다.
p
~]$ nmcli -p con show test-lab
===============================================================================
Connection profile details (test-lab)
===============================================================================
connection.id: test-lab
connection.uuid: 05abfd5e-324e-4461-844e-8501ba704773
connection.interface-name: ens9
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.timestamp: 1410428968
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.secondaries:
connection.gateway-ping-timeout: 0
[output truncated]
, --pretty 옵션을 사용하면 제목 배너와 섹션이 출력에 추가됩니다.
예 3.10. 대화형 편집기를 사용하여 정적 이더넷 연결 구성
대화형 편집기를 사용하여 정적 이더넷 연결을 구성하려면 다음을 수행합니다.
기본 조치는 연결 프로필을 영구적으로 저장하는 것입니다. 필요한 경우 save 임시 명령을 사용하여 다음에 다시 시작할 때까지 메모리에만 프로필을 저장할 수 있습니다.
~]$ nmcli con edit type ethernet con-name ens3
===| nmcli interactive connection editor |===
Adding a new '802-3-ethernet' connection
Type 'help' or '?' for available commands.
Type 'describe [>setting<.>prop<]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli> set ipv4.addresses 192.168.122.88/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes
nmcli>
nmcli> save temporary
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection.
Do you still want to save? [yes] no
nmcli> save
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection.
Do you still want to save? [yes] yes
Connection 'ens3' (704a5666-8cbd-4d89-b5f9-fa65a3dbc916) successfully saved.
nmcli> quit
~]$
NetworkManager 는 내부 매개 변수
connection.autoconnect 를 yes 로 설정합니다. 또한 NetworkManager 는 해당 BOOTPROTO가 none 으로 설정되고 ONBOOT가 yes 로 설정되는 /etc/sysconfig/network-scripts/ifcfg-my-office 에 설정을 작성합니다.
나중에 인터페이스가 표시될 때까지 NetworkManager 는 ifcfg 파일에 대한 수동 변경 사항을 인식하지 못합니다. 설정 파일 사용에 대한 자세한 내용은 2.7절. “sysconfig 파일로 NetworkManager 사용”, 3.5절. “ifcfg 파일을 사용하여 IP 네트워킹 구성” 을 참조하십시오.