현재 네트워크 설정 보기
# ip address show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0d:61:e8:72:a3 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.30/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20d:61ff:fee8:72a3/64 scope link
valid_lft forever preferred_lft forever
또는
#ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0d:61:e8:72:a3
inet addr:192.168.0.30 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20d:61ff:fee8:72a3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:707 errors:0 dropped:0 overruns:0 frame:0
TX packets:621 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:91098 (88.9 KiB) TX bytes:107808 (105.2 KiB)
Interrupt:20
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
장치 인터페이스에 아이피주소를 설정 / 해제
#ip address add 192.168.0.30/24 brd + dev eth0
또는 ifconfig 명령어로
#ifconfig eth0 192.168.0.30 netmask 255.255.255.0 up
Remove / Delete / Deactivate IP address
#ip address del 192.168.0.30 dev eth0
또는
#ifconfig eth0 down
Configuration File 에 영구적으로 설정
#vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
위는 dhcp 설정을 아래와 같이 설정
#vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.30
netmask 255.255.255.0
gateway 192.168.0.1
설정화일을 적용
# /etc/init.d/networking stop
# /etc/init.d/networking start
# /etc/init.d/networking restart