
Ubuntu Server 18.04를 사용하는 하이퍼바이저가 있습니다. VirtualBox로 구동되는 가상 머신이 있습니다. 가상 머신의 인터넷이 "호스트 전용 어댑터"를 통해 작동하도록 iptables 및 iproute2를 설정했습니다.
vboxnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.11.11.11 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::800:27ff:fe00:0 prefixlen 64 scopeid 0x20<link>
ether 0a:00:27:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 72648 bytes 3266388 (3.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vboxnet1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.11.11.11 netmask 255.255.255.255 broadcast 0.0.0.0
ether 0a:00:27:00:00:01 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vboxnet2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.11.11.11 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::800:27ff:fe00:2 prefixlen 64 scopeid 0x20<link>
ether 0a:00:27:00:00:02 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 92219 bytes 10396788 (10.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
가상 머신의 트래픽을 스니핑할 수도 있습니다.
root@hypervisor:~# tcpdump -n -i vboxnet0 port 8642
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vboxnet0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:31:43.676271 IP 188.17.218.126.1971 > 78.29.xx.xx.8642: Flags [P.], seq 3363265001:3363265037, ack 1117219726, win 1026, length 36
12:31:43.676407 IP 78.29.xx.xx.8642 > 188.17.218.126.1971: Flags [.], ack 36, win 501, length 0
12:31:48.673973 IP 188.17.218.126.1971 > 78.29.xx.xx.8642: Flags [P.], seq 36:72, ack 1, win 1026, length 36
12:31:48.674050 IP 78.29.xx.xx.8642 > 188.17.218.126.1971: Flags [.], ack 72, win 501, length 0
12:31:53.675466 IP 188.17.218.126.1971 > 78.29.xx.xx.8642: Flags [P.], seq 72:108, ack 1, win 1026, length 36
12:31:53.675547 IP 78.29.xx.xx.8642 > 188.17.218.126.1971: Flags [.], ack 108, win 501, length 0
^C
6 packets captured
6 packets received by filter
0 packets dropped by kernel
78.29.xx.xx는 가상 머신입니다.
그러나 VM과 관련된 경우 하이퍼바이저의 ifconfig는 트래픽을 계산하지 않습니다.
모든 트래픽을 계산할 수 있는 패키지가 있습니까?