![Linux - 첫 번째 가상 인터페이스만 외부 게이트웨이를 ping할 수 있습니다.](https://linux55.com/image/37699/Linux%20-%20%EC%B2%AB%20%EB%B2%88%EC%A7%B8%20%EA%B0%80%EC%83%81%20%EC%9D%B8%ED%84%B0%ED%8E%98%EC%9D%B4%EC%8A%A4%EB%A7%8C%20%EC%99%B8%EB%B6%80%20%EA%B2%8C%EC%9D%B4%ED%8A%B8%EC%9B%A8%EC%9D%B4%EB%A5%BC%20ping%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
서로 다른 MAC 주소를 사용하여 3개의 가상 인터페이스를 만들었으며 모두 동일한 물리적 인터페이스에 연결되었습니다. 나는 그들이 arp
게이트웨이(gw)에 성공적으로 연결할 수 있고 그렇게 한다는 것을 확인했습니다 ping
(요청은 Wireshark의 패킷 캡처에서 나옵니다).
그러나 ping
유틸리티는 응답을 계산하지 않습니다. 이 문제에 대해 아는 사람이 있나요? 저는 VMware에서 Ubuntu 14.04를 실행하고 있습니다.
IP 링크 정보
root@ubuntu:~# ip link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
IP 주소 정보
root@ubuntu:~# ip addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:febc:fc8b/64 scope link
valid_lft forever preferred_lft forever
IP 라우팅 정보
root@ubuntu:~# ip route sh
가상 인터페이스 추가
root@ubuntu:~# ip link add link eth0 eth0.1 addr 00:00:00:00:00:11 type macvlan
root@ubuntu:~# ip link add link eth0 eth0.2 addr 00:00:00:00:00:22 type macvlan
root@ubuntu:~# ip link add link eth0 eth0.3 addr 00:00:00:00:00:33 type macvlan
추가 확인
root@ubuntu:~# ip -4 link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
18: eth0.1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff
19: eth0.2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff
20: eth0.3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff
IP IPv4 주소 및 라우팅 정보
root@ubuntu:~# ip -4 addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
root@ubuntu:~# ip -4 route sh
eth0.1의 DHCP IP를 가져옵니다.
root@ubuntu:~# dhclient -v eth0.1
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.1/00:00:00:00:00:11
Sending on LPF/eth0.1/00:00:00:00:00:11
Sending on Socket/fallback
DHCPDISCOVER on eth0.1 to 255.255.255.255 port 67 interval 3 (xid=0x568eac05)
DHCPREQUEST of 192.168.1.145 on eth0.1 to 255.255.255.255 port 67 (xid=0x568eac05)
DHCPOFFER of 192.168.1.145 from 192.168.1.254
DHCPACK of 192.168.1.145 from 192.168.1.254
bound to 192.168.1.145 -- renewal in 1473 seconds.
eth0.2의 DHCP IP를 가져옵니다.
root@ubuntu:~# dhclient -v eth0.2
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.2/00:00:00:00:00:22
Sending on LPF/eth0.2/00:00:00:00:00:22
Sending on Socket/fallback
DHCPDISCOVER on eth0.2 to 255.255.255.255 port 67 interval 3 (xid=0x21e3114e)
DHCPREQUEST of 192.168.1.146 on eth0.2 to 255.255.255.255 port 67 (xid=0x21e3114e)
DHCPOFFER of 192.168.1.146 from 192.168.1.254
DHCPACK of 192.168.1.146 from 192.168.1.254
bound to 192.168.1.146 -- renewal in 1366 seconds.
eth0.3의 DHCP IP를 가져옵니다.
root@ubuntu:~# dhclient -v eth0.3
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.3/00:00:00:00:00:33
Sending on LPF/eth0.3/00:00:00:00:00:33
Sending on Socket/fallback
DHCPDISCOVER on eth0.3 to 255.255.255.255 port 67 interval 3 (xid=0x11dc5f03)
DHCPREQUEST of 192.168.1.147 on eth0.3 to 255.255.255.255 port 67 (xid=0x11dc5f03)
DHCPOFFER of 192.168.1.147 from 192.168.1.254
DHCPACK of 192.168.1.147 from 192.168.1.254
bound to 192.168.1.147 -- renewal in 1657 seconds.
인터페이스의 IP 링크 정보
root@ubuntu:~# ip -4 link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff
19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff
20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff
인터페이스 IP 주소 정보
root@ubuntu:~# ip -4 addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.145/24 brd 192.168.1.255 scope global eth0.1
valid_lft forever preferred_lft forever
19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.146/24 brd 192.168.1.255 scope global eth0.2
valid_lft forever preferred_lft forever
20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.147/24 brd 192.168.1.255 scope global eth0.3
valid_lft forever preferred_lft forever
IP 라우팅 정보
root@ubuntu:~# ip -4 route sh
default via 192.168.1.254 dev eth0.1
192.168.1.0/24 dev eth0.1 proto kernel scope link src 192.168.1.145
192.168.1.0/24 dev eth0.2 proto kernel scope link src 192.168.1.146
192.168.1.0/24 dev eth0.3 proto kernel scope link src 192.168.1.147
ARP 테스트 eth0.1
root@ubuntu:~# arping -c 5 -I eth0.1 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.145 eth0.1
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 6.936ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.986ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 0.654ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 5.137ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.426ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
ARP 테스트 eth0.2
root@ubuntu:~# arping -c 5 -I eth0.2 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.146 eth0.2
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 5.665ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 3.753ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 16.500ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 3.287ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 32.438ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
ARP 테스트 eth0.3
root@ubuntu:~# arping -c 5 -I eth0.3 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.147 eth0.3
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 4.422ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.429ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.321ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 40.423ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.268ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
tcpdump eth0.1 - 핑 테스트
root@ubuntu:~# tcpdump -n -i eth0.1 -v &
[1] 5317
root@ubuntu:~# ping -c5 -q -I eth0.1 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.145 eth0.1: 56(84) bytes of data.
tcpdump: listening on eth0.1, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:37.612558 IP (tos 0x0, ttl 64, id 2595, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 2, length 64
13:18:37.618864 IP (tos 0x68, ttl 64, id 14493, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 2, length 64
13:18:37.743650 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:38.134997 IP (tos 0x0, ttl 128, id 23547, offset 0, flags [none], proto UDP (17), length 229)
192.168.1.86.138 > 192.168.1.255.138: NBT UDP PACKET(138)
13:18:38.614580 IP (tos 0x0, ttl 64, id 2596, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 3, length 64
13:18:38.793479 IP (tos 0x68, ttl 64, id 14495, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 3, length 64
13:18:39.151282 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:39.615612 IP (tos 0x0, ttl 64, id 2597, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 4, length 64
13:18:39.746981 IP (tos 0x68, ttl 64, id 14496, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 4, length 64
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4008ms
rtt min/avg/max/mdev = 2.793/67.810/178.934/73.108 ms
깨끗한 tcpdump
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
9 packets captured
12 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.1 -v
tcpdump eth0.2 - 핑 테스트
root@ubuntu:~# tcpdump -n -i eth0.2 -v &
[1] 5320
root@ubuntu:~# ping -c5 -q -I eth0.2 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.146 eth0.2: 56(84) bytes of data.
tcpdump: listening on eth0.2, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:41.536874 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.254 is-at 58:98:35:57:a0:70, length 46
13:18:41.536933 IP (tos 0x0, ttl 64, id 2599, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 1, length 64
13:18:41.539255 IP (tos 0x68, ttl 64, id 14507, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 1, length 64
13:18:42.127715 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:42.511725 IP (tos 0x0, ttl 64, id 2600, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 2, length 64
13:18:42.514385 IP (tos 0x68, ttl 64, id 14527, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 2, length 64
13:18:42.743856 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:43.511727 IP (tos 0x0, ttl 64, id 2601, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 3, length 64
13:18:43.513768 IP (tos 0x68, ttl 64, id 14528, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 3, length 64
13:18:43.637598 IP (tos 0x0, ttl 128, id 23551, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197
13:18:43.641185 IP (tos 0x0, ttl 128, id 23552, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 192.168.1.255.17500: UDP, length 197
13:18:43.641201 IP (tos 0x0, ttl 128, id 23553, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197
13:18:43.743890 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:44.510758 IP (tos 0x0, ttl 64, id 2602, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 4, length 64
13:18:44.512892 IP (tos 0x68, ttl 64, id 14538, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 4, length 64
13:18:45.510794 IP (tos 0x0, ttl 64, id 2603, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 5, length 64
13:18:45.519701 IP (tos 0x68, ttl 64, id 14539, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 5, length 64
13:18:49.287554 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:50.013463 IP (tos 0x0, ttl 255, id 50737, offset 0, flags [DF], proto UDP (17), length 73)
192.168.1.146.5353 > 224.0.0.251.5353: 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)
13:18:50.218874 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:51.129961 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:52.197074 IP6 (hlim 255, next-header UDP (17) payload length: 53) 2001:818:d812:da00:200:ff:fe00:22.5353 > ff02::fb.5353: [udp sum ok] 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)
13:18:54.128240 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4000ms
깨끗한 tcpdump
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
13:18:54.657731 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:54.743174 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
25 packets captured
26 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.2 -v
tcpdump eth0.3 - 핑 테스트
root@ubuntu:~# tcpdump -n -i eth0.3 icmp &
[1] 5324
root@ubuntu:~# ping -c5 -q -I eth0.3 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.147 eth0.3: 56(84) bytes of data.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0.3, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:56.373434 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 1, length 64
13:18:57.372116 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 2, length 64
13:18:57.381263 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 2, length 64
13:18:58.371141 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 3, length 64
13:18:58.373275 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 3, length 64
13:18:59.371165 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 4, length 64
13:18:59.373259 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 4, length 64
13:19:00.371211 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 5, length 64
13:19:00.373278 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 5, length 64
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 1 received, 80% packet loss, time 4001ms
rtt min/avg/max/mdev = 13.666/13.666/13.666/0.000 ms
깨끗한 tcpdump
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
9 packets captured
10 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.3 icmp
arp 캐시 확인
root@ubuntu:~# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.1
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.2
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.3