네트워크 인터페이스(Network interface) 및 IP 주소 확인
장비의 네트워크 인터페이스와 각 인터페이스에 설정된 IP 주소 및 이름서버를 확인 하려면 show interface를 user mode에서 실행하면 됩니다.
LYSH@MyHostName# show interface
lo:
stats : operate=up, up=yes, speed=0MB, duplex=?, mtu=65536
incoming : bytes=79.3G, pkts=310057073, errs=0, drops=0
outgoing : bytes=79.3G, pkts=310057073, errs=0, drops=0
IPv4 address : 127.0.0.1/8
IPv6 address : ::1/128
MAC address : 00:00:00:00:00:00
eth0:
stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500
incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214
outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0
gateway4 : 192.168.0.1
IPv4 address : 192.168.0.40/24
MAC address : 00:01:a2:92:1e:f3
......
DNS Servers: 8.8.8.8
8.8.4.4
LYSH@MyHostName# show interface eth0 // Display only eth0
eth0:
stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500
incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214
outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0
gateway4 : 192.168.0.1
IPv4 address : 192.168.0.40/24
MAC address : 00:01:a2:92:1e:f3
......
DNS Servers: 8.8.8.8
8.8.4.4
LYSH@MyHostName# show interface config // Display interface config file
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- "192.168.3.13/24"
- "2000:3::40/64"
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
dhcp4: false
dhcp6: false
routes:
- to: "default"
via: "192.168.3.1"
- table: 101
to: "192.168.3.0/24"
via: "192.168.3.1"
routing-policy:
- table: 101
from: "192.168.3.0/24"
eth2:
addresses:
- "192.168.4.13/24"
dhcp4: false
dhcp6: false
routes:
- table: 102
to: "192.168.4.0/24"
via: "192.168.4.1"
routing-policy:
- table: 102
from: "192.168.4.0/24"
IP 주소 설정
configuration mode에서 IPv4 또는 IPv6 주소를 설정할 수 있으며 설정 방법은 아래 예시를 참고하세요.
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip add eth0 192.168.0.3/24 192.168.0.1 // Configures an IPv4 address, subnet, and gateway.(i.e. 192.168.0.1) LYSH@MyHostName(config)# ip add eth0 2000:4::40/64 2000:4::1 // Configures an IPv6 address, prefix, and gateway.(i.e, 2000:4::1) interface setting was added. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface LYSH@MyHostName# ping 192.168.0.1 LYSH@MyHostName# ping6 2000:4::1
만일 이미 설정된 주소가 있는데 추가로 다른 주소를 게이트웨이와 함께 등록하면 추가로 등록된 게이트웨이 주소는 무시됩니다. 즉, secondary gateway는 허용되지 않습니다.
IP 주소 삭제
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip delete eth0 192.168.0.3/24 // Deletes an IPv4 address(i.e. 192.168.0.3/24) LYSH@MyHostName(config)# ip delete eth0 2000:4::40/64 // Deletes an IPv6 address(i.e. 2000:4::40/64) interface setting was deleted. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface
하나의 인터페이스에 2개 이상의 IP 주소가 존재하는 경우 해당 인터페이스에서 모든 주소를 삭제해야 게이트웨이 주소도 삭제됩니다.
IP routing 설정
configuration mode에서 routing을 설정할 수 있으며 설정 방법은 아래 예시를 참고하세요.
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip route add 192.168.1.0/24 via 192.168.1.1 dev eth0 // Configures an IPv4 network/subnet, and gateway.(i.e. 192.168.1.1) interface setting was added. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface LYSH@MyHostName# ping 192.168.1.1
동일한 인터페이스에 gateway 또는 routing이 이미 설정되어 있는 경우 덮어쓰기 됩니다.
IP routing 삭제
LYSH@MyHostName# configure // Enters configuration mode. LYSH@MyHostName(config)# ip route delete 192.168.1.0/24 via 192.168.1.1 dev eth0 // Deletes an IPv4 address(i.e. 192.168.1.0/24) LYSH@MyHostName(config)setting was deleted. Do you want to apply these settings?(y/n): y // immediately apply the configurations. LYSH@MyHostName(config)# exit LYSH@MyHostName# show interface
netpaln
네트워크 인터페이스에 주소를 설정 후 바로 적용하는 명령어로 주소를 추가/삭제 후 즉시 적용하지 않은 경우 이 명령어를 이용해 변경된 설정을 적용할 수 있습니다.
LYSH@MyHostName# configure LYSH@MyHostName(config)# netplan apply
이름서버(nameserver)
이름 서버 혹은 DNS(Domain Name System) 서버를 등록 혹은 삭제하려면 아래와 같이 configuration mode에서 진행 할 수 있습니다. 적용된 서버를 확인 하려면 user mode에서 show interface를 실행하세요.
LYSH@MyHostName# configure
LYSH@MyHostName(config)# nameserver add eth0 8.8.8.8 // add a nameserver, 8.8.8.8, into the eth0 interface.
LYSH@MyHostName(config)# nameserver delete eth0 8.8.4.4 // delete a nameserver, 8.8.8.8, from the eth0 interface.
LYSH@MyHostName(config)# exit
LYSH@MyHostName# show interface eth0
stats : operate=up, up=yes, speed=100MB, duplex=full, mtu=1500
incoming : bytes=15.1G, pkts=93920605, errs=0, drops=6869214
outgoing : bytes=65.9G, pkts=76383487, errs=0, drops=0
gateway4 : 192.168.0.1
IPv4 address : 192.168.0.40/24
MAC address : 00:01:a2:92:1e:f3
......
DNS Servers: 8.8.8.8
8.8.4.4
멀티케스트 그룹(Multicast Group) 확인
멀티케스트 그룹인 하려면 show multicast명령어를 사용하세요. DHCPv6 서비스를 운영하는 경우 이 명령어를 통해 서비스가 그룹에 연결되어 있는지 확인해야 합니다. DHCPv6 서비스가 사용하는 멀티케스트 주소는 ff02::1:2와 ff05::1:3입니다.
LYSH@MyHostName# show multicast
1: lo
inet 224.0.0.1
inet6 ff02::1
inet6 ff01::1
2: eth0
link 01:80:c2:00:00:00
inet 224.0.0.1
inet6 ff05::1:3
inet6 ff02::1:2
inet6 ff02::1:ff00:40