🐧운영체제/리눅스
리눅스 - 아이피 변경하는 방법(/etc/network/interfaces)
Janger
2023. 10. 31. 02:28
728x90
예시) 사설 아이피 192.168.57.10을 192.168.57.30으로 변경하고 싶을 경우
편집기(vi, nano)로 /etc/network/interfaces 열기
nano /etc/network/interfaces
수정 전 /etc/network/interfaces
# 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
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.57.10
network 192.168.57.0
netmask 255.255.255.0
gateway 192.168.57.2
수정 후 /etc/network/interfaces
# 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
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.57.30
network 192.168.57.0
netmask 255.255.255.0
gateway 192.168.57.2
네트워크 관리 데몬 재시작
service networking restart
아이피 확인(ifconfig)
ifconfig
root@kali:~/Desktop# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:da:0d:23
inet addr:192.168.57.30 Bcast:192.168.57.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feda:d23/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:276 (276.0 B) TX bytes:2774 (2.7 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1036 (1.0 KiB) TX bytes:1036 (1.0 KiB)
728x90