본문 바로가기
秋 - Tip

서버 IP Address 바꾸기

by 민수아빠™ 2002. 9. 9.
IP Address 관련파일
          /etc/sysconfig/network
          /etc/sysconfig/network-scripts/ifcfg-etho

IP Address 관련 명령어
         ifconfig
         netsats, route


[root@urban root]#
[root@urban root]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:00:B4:9D:C3:6B  
          inet addr:155.230.174.51  Bcast:155.230.175.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1219440 errors:0 dropped:0 overruns:0 frame:3
          TX packets:186521 errors:3 dropped:0 overruns:0 carrier:3
          collisions:12816 txqueuelen:100
          RX bytes:256018832 (244.1 Mb)  TX bytes:112029458 (106.8 Mb)
          Interrupt:9 Base address:0xd800

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:101 errors:0 dropped:0 overruns:0 frame:0
          TX packets:101 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7760 (7.5 Kb)  TX bytes:7760 (7.5 Kb)

[root@urban root]#
[root@urban root]#

netsta라는 명령어로 네트웍관련 설정을 확인한다.

[root@urban root]#
[root@urban root]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
155.230.172.0   0.0.0.0         255.255.252.0   U        40 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
0.0.0.0         155.230.172.5   0.0.0.0         UG       40 0          0 eth0
[root@urban root]#
[root@urban root]#


/etc/sysconfig/network 파일을 수정한다.

[root@urban root]#
[root@urban root]# cd /etc/sysconfig
[root@urban sysconfig]# vi network

NETWORKING=yes
HOSTNAME=urban.knu.ac.kr
GATEWAY=155.230.172.5
~
~
~
~


도메인명을 변경한다.
공대 2호관 내일 경우는 같은 gateway를 사용하게 되므로 gateway는 변경할 필요가 없다.

장치파일 변경하기.
/etc/sysconfig/network-scripts/ifcfg-eth0

[root@urban sysconfig]#
[root@urban sysconfig]# cd /etc/sysconfig/network-scripts/
[root@urban network-scripts]# vi ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
BROADCAST=155.230.175.255
IPADDR=155.230.174.51
NETMASK=255.255.252.0
NETWORK=155.230.172.0
ONBOOT=yes
GATEWAY=155.230.172.5
TYPE=Ethernet
USERCTL=no
PEERDNS=no
~
~


IPADDR 항목을 변경한다.

변경이 끝났으면 변경사항을 적용한다.
/etc/rc.d/init.d/network restart

[root@urban root]#
[root@urban root]# /etc/rc.d/init.d/network restart

Shut down interface eth0:                                     [   OK   ]
Setting network parameters:                                   [   OK   ]
Bringing up interface lo:                                     [   OK   ]
Bringing up interface etho0:                                  [   OK   ]
[root@urban root]#
[root@urban root]#

끝.