티스토리 뷰

System Story/CentOS 5,6

IP Alias

불량펭귄 helperchoi 2013. 11. 10. 20:13

Linux 시스템에서는 하나의 물리적인 Ethernet Device에 대해서 가상의 Device를 추가하여 할당 할 수 있으며 설정 과정은 아래와 같다. 

 

1. ifconfig 명령을 통한 추가

[root@TEST02 ~]#

[root@TEST02 ~]# ifconfig eth0:1 192.168.137.40 netmask 255.255.255.0 up
[root@TEST02 ~]#

 

 

2. ip 명령을 통한 추가

[root@TEST02 ~]#

[root@TEST02 ~]# ip addr add 192.168.137.40/24 dev eth0

[root@TEST02 ~]#

 

 

3. 추가된 Ethernet Alias 확인

[root@TEST02 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:E2:B9:11
inet addr:192.168.137.20 Bcast:192.168.137.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:94893 errors:0 dropped:0 overruns:0 frame:0
TX packets:49062 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22029990 (21.0 MiB) TX bytes:42433842 (40.4 MiB)

eth0:1 Link encap:Ethernet HWaddr 08:00:27:E2:B9:11
inet addr:192.168.137.40 Bcast:192.168.137.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:200 (200.0 b) TX bytes:200 (200.0 b) 

 

 

4. 추가된 가상 Ethernet Device에 대한 Ping 테스트

[root@TEST02 ~]#

[root@TEST02 ~]# ping -c 3 -i 0.1 192.168.137.40
PING 192.168.137.40 (192.168.137.40) 56(84) bytes of data.
64 bytes from 192.168.137.40: icmp_seq=1 ttl=64 time=0.017 ms
64 bytes from 192.168.137.40: icmp_seq=2 ttl=64 time=0.022 ms
64 bytes from 192.168.137.40: icmp_seq=3 ttl=64 time=0.122 ms

--- 192.168.137.40 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 200ms
rtt min/avg/max/mdev = 0.017/0.053/0.122/0.049 ms
[root@TEST02 ~]#
[root@TEST02 ~]#

 

 

반응형
댓글
댓글쓰기 폼