Difference between revisions of "CLI - Networking"

Line 1: Line 1:
IP 주소 설정은 configure 명령어에서 설정할 수 있습니다.
+
Both IPv4 and IPv6 addresses can be configured in the configuration mode.
 
 
 
<pre>
 
<pre>
 
LYSH@MyHostName# configure
 
LYSH@MyHostName# configure
Line 15: Line 14:
 
</pre>
 
</pre>
  
=== Basic Commands ===
+
=== Configuring new IP addresses ===
* <code>configure# ip add eth0 192.168.0.3/24</code> [gateway]는 제외하고 ip를 설정할 수 있습니다.
+
<pre>
* <code>configure# ip add eth1 2000:4::40/64 2000:4::1</code> ipv6 및 gateway를 포함하여 설정합니다.
+
LYSH@MyHostName# configure // Enters configuration mode.
 +
configure# 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)
 +
configure# ip add eth0 2000:4::40/64 2000:4::1 // Configures an IPv6 address, prefix, and gateway.(i.e, 2000:4::1)
 +
configure# netplan apply // immediately apply the configurations.
 +
configure# exit
 +
configure# show interface
 +
LYSH@MyHostName# ping 192.168.0.1
 +
LYSH@MyHostName# ping6 2000:4::1
 +
</pre>
  
=== After Commands ===
+
=== Deleting an IP addresses ===
ip add 명령어로 interface 설정이 완료되면 <code>netplan apply</code>로 변경 사항을 적용할 수 있습니다.
+
<pre>
해당 명령어를 실행하지 않은 경우 재부팅 전까지 변경된 interface는 적용되지 않습니다.
+
LYSH@MyHostName# configure // Enters configuration mode.
* <code>configure# netplan apply</code> 설정한 interface 정보를 적용합니다. 실행결과는 성공/실패로 표시됩니다.
+
configure# ip delete eth0 192.168.0.3/24 // Deletes an IPv4 address(i.e. 192.168.0.3/24)
사용하지 않는 interface의 ip주소는 <code>ip delete</code>명령어로 삭제합니다.
+
configure# ip delete eth0 2000:4::40/64 // Deletes an IPv6 address(i.e. 2000:4::40/64)
* <code>configure# ip delete eth0 192.168.0.3/24</code> eth0 인터페이스의 192.168.0.3/24 가 삭제됩니다.
+
configure# netplan apply // immediately apply the configurations.
ip 주소 삭제 명령어 이후 <code>netplan apply</code>로 변경 사항을 적용할 수 있습니다.
+
configure# exit
 +
configure# show interface
 +
</pre>

Revision as of 16:36, 15 April 2021

Both IPv4 and IPv6 addresses can be configured in the configuration mode.

LYSH@MyHostName# configure
configure# ip add -h
usage: ip add [-h] interface ip [gateway]

positional arguments:
  interface   Ethernet interface name
  ip          IPv4/Subnet Mask or IPv6 address/prefix
  [gateway]   IPv4 or IPv6 address

optional arguments:
  -h, --help  show this help message and exit

Configuring new IP addresses

LYSH@MyHostName# configure				// Enters configuration mode.
configure# 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)
configure# ip add eth0 2000:4::40/64 2000:4::1		// Configures an IPv6 address, prefix, and gateway.(i.e, 2000:4::1)
configure# netplan apply				// immediately apply the configurations.
configure# exit
configure# show interface
LYSH@MyHostName# ping 192.168.0.1		
LYSH@MyHostName# ping6 2000:4::1				

Deleting an IP addresses

LYSH@MyHostName# configure				// Enters configuration mode.
configure# ip delete eth0 192.168.0.3/24		// Deletes an IPv4 address(i.e. 192.168.0.3/24)
configure# ip delete eth0 2000:4::40/64			// Deletes an IPv6 address(i.e. 2000:4::40/64)
configure# netplan apply				// immediately apply the configurations.
configure# exit
configure# show interface