convert pcregrep command in awk or sed - awk

I have a multiline matching pcregrep command that I'd like to convert into an awk or sed command, because I need it on a machine where pcregrep is not available (OS X).
Original command:
ifconfig -a | pcregrep -M '^[a-z].*\n(\t[^\n]+\n)+\t[^\n]+baseTX' | grep -oE "^([a-z]+[^:]+)"
It output the name of the interface that contains the string “baseTX” (only method I found to reliably find out the name of the ethernet interface on a MacBook). In my case, “en4”.
The input text look like this:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether xx:xx:xx:xx:xx:xx
inet6 xxxx::xxxx:xxxx:xxxx:xxx%en0 prefixlen 64 scopeid 0x4
inet 10.xxx.xxx.xx netmask 0xffffff00 broadcast 10.xxx.xxx.255
inet6 xxxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 128
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
en5: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
media: autoselect <full-duplex>
status: inactive
en6: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
media: autoselect <full-duplex>
status: inactive
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=4<VLAN_MTU>
ether xx:xx:xx:xx:xx:xx
inet6 xxxx::xxxx:xxxx:xxxx:xxxx%en4 prefixlen 64 scopeid 0x7
inet XX.XXX.XXX.XX netmask 0xffffff00 broadcast XX.XXX.XXX.XXX
inet6 xxxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 128
nd6 options=1<PERFORMNUD>
media: autoselect (100baseTX <full-duplex>)
status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en5 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 5 priority 0 path cost 0
member: en6 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
nd6 options=1<PERFORMNUD>
media: <unknown type>
status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether xx:xx:xx:xx:xx:xx
media: autoselect
status: inactive
How can I grap “en4” with awk or sed? I tried for one hour, but I am just bad at sed and awk.

Assuming that spacing is consistent (leading spaces are only on non-header lines) this should work:
awk -F: '/^[[:alpha:]]/ {iface=$1; next} /baseTX/ {print iface; exit}'

perl:
perl -0777 -nE 'say map {/^\w+/ && $&} grep {/baseTX/} split /^(?=\w+:)/m'

Related

OpenNebula - Bridge VM NIC with Host NIC - take Ip from LAN DCHP

I hope you are doing well,
I start using OpenNebula here, I deploy a basic setup one Opennebula fronend in centos 8
another server as OpenNebula Node,
I download an image from marketplace it's centos image, Then I create a network Under Network >> Virual Network. Bridge it with ens33 (ens3 is the physical interface of my node) in order to give VM access to LAN,
he is my Node net
[centos#host1 ~]$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.60 netmask 255.255.255.0 broadcast 192.168.0.255
ether 00:0c:29:68:26:2b txqueuelen 1000 (Ethernet)
RX packets 679155 bytes 994474147 (948.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 41914 bytes 3220552 (3.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 6 bytes 672 (672.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 672 (672.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:89:84:b1 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
once I create a VM and attach it to the bridge network I create already, i get status Failed with the bellow log :
Sat May 1 03:50:25 2021 [Z0][VM][I]: New state is ACTIVE
Sat May 1 03:50:25 2021 [Z0][VM][I]: New LCM state is PROLOG
Sat May 1 03:50:38 2021 [Z0][VM][I]: New LCM state is BOOT
Sat May 1 03:50:38 2021 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/14/deployment.0
Sat May 1 03:50:39 2021 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Sat May 1 03:50:40 2021 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vnm/bridge/pre
Sat May 1 03:50:40 2021 [Z0][VMM][E]: pre: Command "sudo ip link add name ens33 type bridge " failed.
Sat May 1 03:50:40 2021 [Z0][VMM][E]: pre: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VMM][E]: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VMM][E]:
Sat May 1 03:50:40 2021 [Z0][VMM][I]: ExitCode: 2
Sat May 1 03:50:40 2021 [Z0][VMM][I]: Failed to execute network driver operation: pre.
Sat May 1 03:50:40 2021 [Z0][VMM][E]: Error deploying virtual machine: bridge: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VM][I]: New LCM state is BOOT_FAILURE
can anyone please explain to me what's wrong here, Im familiar with vsphere esxi/vcenter, I want just to create a VMNetwork and attach it to the node physical NIC then attach the VM to this VMNetwork in order to give it LAN access, on VMware side it's easy simple but with OpenNebula Im not sure how it's work
Thank you
The problem here is that you are using a physical interface instead of using a bridge. If you would like to use bridge networking, you need to create a bridge or let OpenNebula create it for you.
Let me know if this answers your issue, if not, feel free to submit your query on OpenNebula Forum - https://forum.opennebula.io/. :)

New Sap Instance not working. No instance profiles found

I have installed sap server 7.51 on ubuntu virtual machine (vmware). Installation was sucessful but when I run start I get the following error:
ubuntu:npladm 1> startsap all
No instance profiles found
please send the tracefile /home/npladm/startsap.trc to support
I typed ifconfig and got the following:
ens33: flags=4163 mtu 1500
inet 192.168.234.130 netmask 255.255.255.0 broadcast 192.168.234.255
inet6 fe80::e152:4277:1c5f:3311 prefixlen 64 scopeid 0x20
ether 00:0c:29:9f:48:53 txqueuelen 1000 (Ethernet)
RX packets 1739 bytes 1139138 (1.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1406 bytes 145716 (145.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 5009 bytes 1102113 (1.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5009 bytes 1102113 (1.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I checked that the ip address in the host file is correct as in:
cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
# mapping the Ubuntu loopback IP 127.0.1.1 to ubuntu
192.168.234.130 ubuntu ubuntu.dummy.nodomain
# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
127.0.0.1 localhost
127.0.1.1 ubuntu
# mapping the Ubuntu loopback IP 127.0.1.1 to vhcalnplci
127.0.1.1 vhcalnplci vhcalnplci.dummy.nodomain
As you can see the ip adress should be correct (192.168.234.130) and is pingable but it is still not working.
Update:
Here is also the trace log file:
Trace of system startup/check of SAP System NPL on Mon Jul 1 01:08:45 PDT 2019
{01:08:45 ## Main() start: #=/usr/sap/NPL/SYS/exe/uc/linuxx86_64/startsap all
#(#) $Id: //bas/749_STACK/src/krn/startscripts/startsap#1 $
BASENAME=startsap
{01:08:45 ## check_user() start: #=npladm
}01:08:45 ## check_user() done
#=1
#=all
{01:08:45 ## setPlatform() start
PLATFORM=linuxx86_64
}01:08:45 ## setPlatform() done
{01:08:45 ## setPing() start
PING=/bin/ping
}01:08:45 ## setPing() done
{01:08:45 ## setIfconfig() start
IFCONFIG=/sbin/ifconfig
}01:08:45 ## setIfconfig() done
{01:08:45 ## setIp() start
IP=/sbin/ip
}01:08:45 ## setIp() done
{01:08:45 ## setRootDir() start: #=
USR_SAP=/usr/sap
USR_SAP_SID=/usr/sap/NPL
PROFILE_DIR=/usr/sap/NPL/SYS/profile
DIR_LIBRARY=/usr/sap/NPL/SYS/exe/run
}01:08:45 ## setRootDir() done
{01:08:45 ## setDbUser() start: #=
}01:08:45 ## setDbUser() done
Argument=all
{01:08:45 ## getarg() start
{01:08:45 ## checkInstance() start: #=all
}01:08:45 ## checkInstance() done: 1
{01:08:45 ## checkTask() start: #=all
_opt=all
}01:08:45 ## checkTask() done: 0
TASK=ALL
}01:08:45 ## getarg() done: 1
{01:08:45 ## setVHostArray() start
_PROFILES=/usr/sap/NPL/SYS/profile/NPL_ASCS01_ubuntu /usr/sap/NPL/SYS/profile/NPL_D00_ubuntu
_nrProfiles=2
{01:08:45 ## pushVHostsFromProfile() start: #=/usr/sap/NPL/SYS/profile/NPL_ASCS01_ubuntu /usr/sap/NPL/SYS/profile/NPL_D00_ubuntu
_DUMMY=NPL_ASCS01_ubuntu
_VHOST=ubuntu
{01:08:45 ## isVHostLocal() start: ubuntu
VHOST=ubuntu
_IS_LOCAL=0
}01:08:46 ## isVHostLocal() done: 0
_DUMMY=NPL_D00_ubuntu
_VHOST=ubuntu
{01:08:46 ## isVHostLocal() start: ubuntu
VHOST=ubuntu
_IS_LOCAL=0
}01:08:46 ## isVHostLocal() done: 0
VHOSTS=
}01:08:46 ## pushVHostsFromProfile() done
VHOSTS=
}01:08:46 ## setVHostArray() done
{01:08:46 ## set_instance() start
NINST=
INSTFOUND=0
NINSTFOUND=0
hasABAP=0
hasJava=0
hasSpecial=0
}01:08:46 ## set_instance() done
No instance profiles found
Exit code 8
Any other ideas about the error and how to resolve it? Thanks.
updating the ip-address of my VM in /etc/hosts helped:
> sudo nano /etc/hosts
..
192.168.1.218 vhcalnplci vhcalnplci.dummy.nodomain
.. then i started server
> startsap ALL
.. and checked that instances are running
> sapcontrol -nr 00 -function GetProcessList

sipjs and asterisk voice call no audio issue

I am using sipjs 0.7.5 version and asterisk 13.12.1 to established call between 2 sipjs call through webRTC. Both sipjs client and asterisk server are in local network. I am giving asterisk log of both sip messages and rtp packet bellow:
My problem is from log I am seeing that RTP packet is getting sent to both end via ICE. but in client browser no audio is playing. i.e. there is no audio in browser.
<--- SIP read from WS:192.168.40.48:10380 --->
INVITE sip:1063#192.168.40.45:5060 SIP/2.0
Via: SIP/2.0/WS 192.0.2.208;branch=z9hG4bK4771627
Max-Forwards: 70
To: <sip:1063#192.168.40.45:5060>
From: "1062" <sip:1062#192.168.40.45:5060>;tag=dc2e904hed
Call-ID: iu2sjhg9scpcrir0slju
CSeq: 8911 INVITE
Contact: <sip:haitt3bm#192.0.2.208;transport=ws;ob>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Content-Type: application/sdp
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Length: 1220
v=0
o=mozilla...THIS_IS_SDPARTA-49.0.2 2371358821422302787 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 DD:4B:CC:5D:70:15:CE:34:6B:A7:AF:2A:F8:AA:E8:B8:00:C3:28:F6:C8:9C:03:F5:E6:69:04:D6:81:11:3B:85
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 55294 UDP/TLS/RTP/SAVPF 109 9 0 8
c=IN IP4 192.168.35.1
a=candidate:0 1 UDP 2122252543 192.168.35.1 55294 typ host
a=candidate:1 1 UDP 2122187007 192.168.221.1 55295 typ host
a=candidate:2 1 UDP 2122121471 192.168.40.48 55296 typ host
a=candidate:0 2 UDP 2122252542 192.168.35.1 55297 typ host
a=candidate:1 2 UDP 2122187006 192.168.221.1 55298 typ host
a=candidate:2 2 UDP 2122121470 192.168.40.48 55299 typ host
a=sendrecv
a=end-of-candidates
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=fmtp:109 maxplaybackrate=48000;stereo=1
a=ice-pwd:43428b6027fb801be25dae4fdf05981a
a=ice-ufrag:84b4daa9
a=mid:sdparta_0
a=msid:{aaa3da10-5310-4167-b4b7-8328a8e5ba84} {4bee853d-06c4-4bfd-ae69-319a1994c844}
a=rtcp:55297 IN IP4 192.168.35.1
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=setup:actpass
a=ssrc:1072212720 cname:{a978e140-65a4-49e8-bb8b-2273ab1b6026}
<------------->
--- (13 headers 32 lines) ---
Using INVITE request as basis request - iu2sjhg9scpcrir0slju
Found peer '1062' for '1062' from 192.168.40.48:10380
== DTLS ECDH initialized (automatic), faster PFS enabled
== DTLS ECDH initialized (automatic), faster PFS enabled
== Using SIP VIDEO CoS mark 6
== Using SIP RTP CoS mark 5
[Nov 2 10:07:30] NOTICE[64407][C-00000008]: chan_sip.c:10315 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled, enabling: audio 55294 UDP/TLS/RTP/SAVPF 109 9 0 8
Found RTP audio format 109
Found RTP audio format 9
Found RTP audio format 0
Found RTP audio format 8
Found audio description format opus for ID 109
Found audio description format G722 for ID 9
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Capabilities: us - (ulaw|alaw|gsm|h263), peer - audio=(ulaw|alaw|g722|opus)/video=(nothing)/text=(nothing), combined - (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x0 (nothing), combined - 0x0 (nothing)
Peer audio RTP is at port 192.168.35.1:55294
Peer doesn't provide video
Looking for 1063 in default (domain 192.168.40.45)
sip_route_dump: route/path hop: <sip:haitt3bm#192.0.2.208;transport=ws;ob>
<--- Transmitting (no NAT) to 192.168.40.48:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/WS 192.0.2.208;branch=z9hG4bK4771627;received=192.168.40.48
From: "1062" <sip:1062#192.168.40.45:5060>;tag=dc2e904hed
To: <sip:1063#192.168.40.45:5060>
Call-ID: iu2sjhg9scpcrir0slju
CSeq: 8911 INVITE
Server: Asterisk PBX 13.12.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1063#192.168.40.45:5060;transport=WS>
Content-Length: 0
<------------>
-- Executing [1063#default:1] Dial("SIP/1062-00000010", "SIP/1063") in new stack
== DTLS ECDH initialized (automatic), faster PFS enabled
== DTLS ECDH initialized (automatic), faster PFS enabled
== Using SIP VIDEO CoS mark 6
== Using SIP RTP CoS mark 5
Audio is at 14284
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.40.48:10383:
INVITE sip:thqqcmh6#192.0.2.218;transport=ws SIP/2.0
Via: SIP/2.0/WS 192.168.40.45:5060;branch=z9hG4bK3f05c747
Max-Forwards: 70
From: "1062" <sip:1062#192.168.40.45>;tag=as0cfcb1f6
To: <sip:thqqcmh6#192.0.2.218;transport=ws>
Contact: <sip:1062#192.168.40.45:5060;transport=WS>
Call-ID: 30d68fec7f1ab1ad5f413e2031ad3290#192.168.40.45:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.12.1
Date: Wed, 02 Nov 2016 04:07:32 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 878
v=0
o=root 1773642892 1773642892 IN IP4 192.168.40.45
s=Asterisk PBX 13.12.1
c=IN IP4 192.168.40.45
t=0 0
m=audio 14284 RTP/SAVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=ice-ufrag:72465290354ec1f13cdfbb24592c36f1
a=ice-pwd:2e3f757f3f18a66e4ce88b32509c65d3
a=candidate:Hc0a8282d 1 UDP 2130706431 192.168.40.45 14284 typ host
a=candidate:Sb6a06f32 1 UDP 1694498815 182.160.111.50 14284 typ srflx raddr 192.168.40.45 rport 14284
a=candidate:Hc0a8282d 2 UDP 2130706430 192.168.40.45 14285 typ host
a=candidate:Sb6a06f32 2 UDP 1694498814 182.160.111.50 14285 typ srflx raddr 192.168.40.45 rport 14285
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 4B:8C:EF:A9:7A:59:B0:3A:73:B2:BF:70:4D:EC:94:B4:03:BD:FA:5C:E0:50:F8:CD:5B:52:CC:21:5E:D2:32:D4
a=sendrecv
---
-- Called SIP/1063
<--- SIP read from WS:192.168.40.48:10383 --->
SIP/2.0 100 Trying
Via: SIP/2.0/WS 192.168.40.45:5060;branch=z9hG4bK3f05c747
To: <sip:thqqcmh6#192.0.2.218;transport=ws>
From: "1062" <sip:1062#192.168.40.45>;tag=as0cfcb1f6
Call-ID: 30d68fec7f1ab1ad5f413e2031ad3290#192.168.40.45:5060
CSeq: 102 INVITE
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Length: 0
<------------->
--- (9 headers 0 lines) ---
<--- SIP read from WS:192.168.40.48:10383 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/WS 192.168.40.45:5060;branch=z9hG4bK3f05c747
To: <sip:thqqcmh6#192.0.2.218;transport=ws>;tag=iliacjnojs
From: "1062" <sip:1062#192.168.40.45>;tag=as0cfcb1f6
Call-ID: 30d68fec7f1ab1ad5f413e2031ad3290#192.168.40.45:5060
CSeq: 102 INVITE
Contact: <sip:thqqcmh6#192.0.2.218;transport=ws>
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Length: 0
<------------->
--- (10 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:thqqcmh6#192.0.2.218;transport=ws>
-- SIP/1063-00000011 is ringing
<--- Transmitting (no NAT) to 192.168.40.48:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/WS 192.0.2.208;branch=z9hG4bK4771627;received=192.168.40.48
From: "1062" <sip:1062#192.168.40.45:5060>;tag=dc2e904hed
To: <sip:1063#192.168.40.45:5060>;tag=as6443d323
Call-ID: iu2sjhg9scpcrir0slju
CSeq: 8911 INVITE
Server: Asterisk PBX 13.12.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1063#192.168.40.45:5060;transport=WS>
Content-Length: 0
<------------>
<--- SIP read from WS:192.168.40.48:10383 --->
SIP/2.0 200 OK
Via: SIP/2.0/WS 192.168.40.45:5060;branch=z9hG4bK3f05c747
To: <sip:thqqcmh6#192.0.2.218;transport=ws>;tag=iliacjnojs
From: "1062" <sip:1062#192.168.40.45>;tag=as0cfcb1f6
Call-ID: 30d68fec7f1ab1ad5f413e2031ad3290#192.168.40.45:5060
CSeq: 102 INVITE
Contact: <sip:thqqcmh6#192.0.2.218;transport=ws>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Type: application/sdp
Content-Length: 2050
v=0
o=- 8316228832686210830 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS Lezzrl9JzDRw0rDdgktZDKQiqy9HrSw4vQzI
m=audio 55300 UDP/TLS/RTP/SAVP 0 8 101
c=IN IP4 192.168.35.1
a=rtcp:55303 IN IP4 192.168.35.1
a=candidate:1468545711 1 udp 2122260223 192.168.35.1 55300 typ host generation 0 network-id 3
a=candidate:4198037383 1 udp 2122194687 192.168.221.1 55301 typ host generation 0 network-id 2
a=candidate:235970510 1 udp 2122129151 192.168.40.48 55302 typ host generation 0 network-id 1 network-cost 10
a=candidate:1468545711 2 udp 2122260222 192.168.35.1 55303 typ host generation 0 network-id 3
a=candidate:4198037383 2 udp 2122194686 192.168.221.1 55304 typ host generation 0 network-id 2
a=candidate:235970510 2 udp 2122129150 192.168.40.48 55305 typ host generation 0 network-id 1 network-cost 10
a=candidate:420202079 1 tcp 1518280447 192.168.35.1 9 typ host tcptype active generation 0 network-id 3
a=candidate:3032157047 1 tcp 1518214911 192.168.221.1 9 typ host tcptype active generation 0 network-id 2
a=candidate:1083401022 1 tcp 1518149375 192.168.40.48 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:420202079 2 tcp 1518280446 192.168.35.1 9 typ host tcptype active generation 0 network-id 3
a=candidate:3032157047 2 tcp 1518214910 192.168.221.1 9 typ host tcptype active generation 0 network-id 2
a=candidate:1083401022 2 tcp 1518149374 192.168.40.48 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=ice-ufrag:Y4fJ
a=ice-pwd:v8rrrqGJU+aLsIg34kJbx9KL
a=fingerprint:sha-256 E0:34:1F:A5:DC:CA:56:F1:D1:70:61:DD:7F:F6:7A:34:F0:D7:9D:53:EF:22:0C:AB:09:63:B9:F5:1F:63:E4:E3
a=setup:active
a=mid:audio
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=ssrc:4040961807 cname:zubAX2k8KRNEKsTO
a=ssrc:4040961807 msid:Lezzrl9JzDRw0rDdgktZDKQiqy9HrSw4vQzI b17cfaa5-2826-4bce-9f23-be489c523d03
a=ssrc:4040961807 mslabel:Lezzrl9JzDRw0rDdgktZDKQiqy9HrSw4vQzI
a=ssrc:4040961807 label:b17cfaa5-2826-4bce-9f23-be489c523d03
<------------->
--- (12 headers 33 lines) ---
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - (ulaw|alaw|gsm|h263), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.35.1:55300
sip_route_dump: route/path hop: <sip:thqqcmh6#192.0.2.218;transport=ws>
set_destination: Parsing <sip:thqqcmh6#192.0.2.218;transport=ws> for address/port to send to
set_destination: URI is for WebSocket, we can't set destination
Transmitting (no NAT) to 192.0.2.218:5060:
ACK sip:thqqcmh6#192.0.2.218;transport=ws SIP/2.0
Via: SIP/2.0/WS 192.168.40.45:5060;branch=z9hG4bK52a8c1f1
Max-Forwards: 70
From: "1062" <sip:1062#192.168.40.45>;tag=as0cfcb1f6
To: <sip:thqqcmh6#192.0.2.218;transport=ws>;tag=iliacjnojs
Contact: <sip:1062#192.168.40.45:5060;transport=WS>
Call-ID: 30d68fec7f1ab1ad5f413e2031ad3290#192.168.40.45:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.12.1
Content-Length: 0
---
-- SIP/1063-00000011 answered SIP/1062-00000010
Audio is at 11134
Adding codec ulaw to SDP
Adding codec alaw to SDP
<--- Reliably Transmitting (no NAT) to 192.168.40.48:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/WS 192.0.2.208;branch=z9hG4bK4771627;received=192.168.40.48
From: "1062" <sip:1062#192.168.40.45:5060>;tag=dc2e904hed
To: <sip:1063#192.168.40.45:5060>;tag=as6443d323
Call-ID: iu2sjhg9scpcrir0slju
CSeq: 8911 INVITE
Server: Asterisk PBX 13.12.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1063#192.168.40.45:5060;transport=WS>
Content-Type: application/sdp
Content-Length: 797
v=0
o=root 562796326 562796326 IN IP4 192.168.40.45
s=Asterisk PBX 13.12.1
c=IN IP4 192.168.40.45
t=0 0
m=audio 11134 RTP/SAVPF 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=maxptime:150
a=ice-ufrag:58d669ea38ed577755928de05ad017a0
a=ice-pwd:4513e77c0ac114a14e1f9a654764e1e9
a=candidate:Hc0a8282d 1 UDP 2130706431 192.168.40.45 11134 typ host
a=candidate:Sb6a06f32 1 UDP 1694498815 182.160.111.50 11134 typ srflx raddr 192.168.40.45 rport 11134
a=candidate:Hc0a8282d 2 UDP 2130706430 192.168.40.45 11135 typ host
a=candidate:Sb6a06f32 2 UDP 1694498814 182.160.111.50 11135 typ srflx raddr 192.168.40.45 rport 11135
a=connection:new
a=setup:active
a=fingerprint:SHA-256 4B:8C:EF:A9:7A:59:B0:3A:73:B2:BF:70:4D:EC:94:B4:03:BD:FA:5C:E0:50:F8:CD:5B:52:CC:21:5E:D2:32:D4
a=sendrecv
<------------>
-- Channel SIP/1063-00000011 joined 'simple_bridge' basic-bridge <047baea4-91e3-43fa-99ec-5b49d10b595c>
-- Channel SIP/1062-00000010 joined 'simple_bridge' basic-bridge <047baea4-91e3-43fa-99ec-5b49d10b595c>
> 0x7f243407b350 -- Probation passed - setting RTP source address to 192.168.40.48:55302
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012779, ts 909638055, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012780, ts 909638215, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012781, ts 909638375, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012782, ts 909638535, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012783, ts 909638695, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012784, ts 909638855, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012785, ts 909639015, len 000160)
<--- SIP read from WS:192.168.40.48:10380 --->
ACK sip:1063#192.168.40.45:5060;transport=ws SIP/2.0
Via: SIP/2.0/WS 192.0.2.208;branch=z9hG4bK6228050
Max-Forwards: 70
To: <sip:1063#192.168.40.45:5060>;tag=as6443d323
From: "1062" <sip:1062#192.168.40.45:5060>;tag=dc2e904hed
Call-ID: iu2sjhg9scpcrir0slju
CSeq: 8911 ACK
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Length: 0
<------------->
--- (10 headers 0 lines) ---
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012786, ts 909639175, len 000160)
Sent RTP packet to 192.168.35.1:55294 (via ICE) (type 00, seq 006802, ts 909639168, len 000160)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012787, ts 909639335, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006803, ts 909639328, len 000170)
> 0x7f24340788f0 -- Probation passed - setting RTP source address to 192.168.40.48:55296
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029688, ts 3658919058, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024034, ts 3658919056, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012788, ts 909639495, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006804, ts 909639488, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029689, ts 3658919218, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024035, ts 3658919216, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012789, ts 909639655, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006805, ts 909639648, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029690, ts 3658919378, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024036, ts 3658919376, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012790, ts 909639815, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006806, ts 909639808, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029691, ts 3658919538, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024037, ts 3658919536, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012791, ts 909639975, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006807, ts 909639968, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029692, ts 3658919698, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024038, ts 3658919696, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012792, ts 909640135, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006808, ts 909640128, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029693, ts 3658919858, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024039, ts 3658919856, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012793, ts 909640295, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006809, ts 909640288, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029694, ts 3658920018, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024040, ts 3658920016, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012794, ts 909640455, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006810, ts 909640448, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029695, ts 3658920178, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024041, ts 3658920176, len 000170)
Got RTP packet from 192.168.40.48:55302 (type 00, seq 012795, ts 909640615, len 000160)
Sent RTP packet to 192.168.40.48:55296 (via ICE) (type 00, seq 006811, ts 909640608, len 000170)
Got RTP packet from 192.168.40.48:55296 (type 00, seq 029696, ts 3658920338, len 000160)
Sent RTP packet to 192.168.40.48:55302 (via ICE) (type 00, seq 024042, ts 3658920336, len 000170)

Can't connect to localhost after upgrading to El Capitan

After updating to El Capitan I can't access localhost.
Another computer where El Capitan was already at the installation of MAMP everything works fine.
Both Apache and MySQL server start ,but can't get to localhost page
This is what I've tried so far:
1) Uncommented some of the lines on httpd.conf as indicated on some messages
2) Replaced current files with files in private/etc/apache2/original
3) Copied http.conf and extra/ from the other computer (the one where localhost is working)
4) Tried different ports configuration (Apache: 8888 & MySql: 8889)
Since none of the above worked, I put back files to the original state (i.e. before uncommenting or replacing)
Finally, if instead of localhost I type computer_name.local/ on the browser address bar I can see my files.
I am VERY new with all this, any suggestions?
Thanks,
S
Denis, thanks for the suggestion. These are the results from Terminal:
lo0: flags=8049 mtu 16384
options=3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=1
gif0: flags=8010 mtu 1280
stf0: flags=0<> mtu 1280
en1: flags=8823 mtu 1500
ether 88:63:df:cb:a5:39
nd6 options=1
media: autoselect ()
status: inactive
en0: flags=8863 mtu 1500
options=10b
ether ac:87:a3:14:72:1b
nd6 options=1
media: autoselect (none)
status: inactive
en2: flags=963 mtu 1500
options=60
ether 0a:00:00:3c:bc:00
media: autoselect
status: inactive
en3: flags=963 mtu 1500
options=60
ether 0a:00:00:3c:bc:01
media: autoselect
status: inactive
en5: flags=8863 mtu 1500
options=10b
ether 40:6c:8f:38:4f:a5
inet6 fe80::426c:8fff:fe38:4fa5%en5 prefixlen 64 scopeid 0x8
inet 192.168.1.21 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=1
media: autoselect (1000baseT )
status: active
en7: flags=8863 mtu 1460
ether 02:50:f2:00:00:01
nd6 options=1
media: autoselect
status: inactive
p2p0: flags=8802 mtu 2304
ether 0a:63:df:cb:a5:39
media: autoselect
status: inactive
bridge0: flags=8863 mtu 1500
options=63
ether 8a:63:df:bc:63:00
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en2 flags=3
ifmaxaddr 0 port 6 priority 0 path cost 0
member: en3 flags=3
ifmaxaddr 0 port 7 priority 0 path cost 0
nd6 options=1
media:
status: inactive
awdl0: flags=8902 mtu 1484
ether 52:4f:2b:35:96:9d
nd6 options=1
media: autoselect
status: inactive

UDP multicast client does not see UDP multicast traffic generated by tcpreplay

I have two programs:
server ... it generates UDP traffic on a chosen multicast
listener ... it prints UDP traffic on a chosen multicast
(it subscribes to a multicast and prints
whatever it receives).
When I run the server on one machine and listeners on some (other) machine(s), the listener sees UDP traffic and prints it correctly. So these programs should be in a good shape.
However, when I try to capture the traffic, on whatever machine, with tcpdump:
sudo tcpdump -i eth0 'dst 233.65.120.153' -w 0.pcap
and when I later try to replay it, on whatever machine, with tcpreplay:
sudo tcpreplay -i eth0 0.pcap
none of the listeners sees those captured packets:
09:38:40.975604 IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 32)
172.27.6.176.53507 > 233.65.120.153.64968: [udp sum ok] UDP, length 4
0x0000: 4500 0020 0000 4000 0111 6527 ac1b 06b0 E.....#...e'....
0x0010: e941 7899 d103 fdc8 000c 579c 6162 6364 .Ax.......W.abcd
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
09:38:41.975709 IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 32)
172.27.6.176.53507 > 233.65.120.153.64968: [udp sum ok] UDP, length 4
0x0000: 4500 0020 0000 4000 0111 6527 ac1b 06b0 E.....#...e'....
0x0010: e941 7899 d103 fdc8 000c 579c 6162 6364 .Ax.......W.abcd
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
09:38:42.975810 IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 32)
172.27.6.176.53507 > 233.65.120.153.64968: [udp sum ok] UDP, length 4
0x0000: 4500 0020 0000 4000 0111 6527 ac1b 06b0 E.....#...e'....
0x0010: e941 7899 d103 fdc8 000c 579c 6162 6364 .Ax.......W.abcd
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
Note that even though none of the listeners sees UDP multicast traffic, I am still able to see it, on whatever machine, with tcpdump:
sudo tcpdump -i eth0 'dst 233.65.120.153' -X
My question: What should I do (differently) if I want to tcpreplay the UDP multicast traffic I am creating so that I can see it on application level (e.g. my listener program), not only by tcpdump?
$ cat sender.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define PORT 64968
#define GROUP "233.65.120.153"
main(int argc, char *argv[])
{
struct sockaddr_in addr;
int fd, cnt;
struct ip_mreq mreq;
char *message="abcd";
/* Create what looks like an ordinary UDP socket:
AF_INET ... IPv4
SOCK_DGRAM ... UDP
0 ... required constant
*/
if ((fd=socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
exit(1);
}
/* Set up destination address:
AF_INET ... IPv4
GROUP ... the IP-address of the multicast group
to which we want to multicast
PORT ... the UDP port that on which we want to multicast
*/
memset(&addr, 0, sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_addr.s_addr=inet_addr(GROUP);
addr.sin_port=htons(PORT);
/* now just sendto() our destination! */
while (1) {
if (sendto(fd, message, strlen(message), 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("sendto");
exit(1);
}
sleep(1);
}
}
$ cat listener.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define PORT 64968
#define GROUP "233.65.120.153"
#define MSGBUFSIZE 1000000
char msgbuf[MSGBUFSIZE];
main(int argc, char *argv[])
{
struct sockaddr_in addr;
int fd, nbytes,addrlen;
struct ip_mreq mreq;
u_int yes=1;
/* Create what looks like an ordinary UDP socket:
AF_INET ... IPv4
SOCK_DGRAM ... UDP
0 ... required constant
*/
if ((fd=socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
exit(1);
}
/* Allow multiple sockets to use the same PORT number:
SOL_SOCKET ... manipulate properties of the socket API itself
SO_REUSEADDR ... Allow reuse of local addresses for bind
*/
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
perror("Reusing ADDR failed");
exit(1);
}
/* set up destination address */
memset(&addr,0,sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_addr.s_addr=htonl(INADDR_ANY); /* N.B.: differs from sender */
addr.sin_port=htons(PORT);
/* bind to receive address */
if (bind(fd,(struct sockaddr *) &addr,sizeof(addr)) < 0) {
perror("bind");
exit(1);
}
/* use setsockopt() to request that the kernel join a multicast group */
mreq.imr_multiaddr.s_addr=inet_addr(GROUP);
mreq.imr_interface.s_addr=htonl(INADDR_ANY);
if (setsockopt(fd,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq)) < 0) {
perror("setsockopt");
exit(1);
}
/* now just enter a read-print loop */
while (1) {
addrlen=sizeof(addr);
memset(msgbuf, 0, MSGBUFSIZE);
if ((nbytes=recvfrom(fd, msgbuf, MSGBUFSIZE,0,
(struct sockaddr *) &addr, &addrlen)) < 0) {
perror("recvfrom");
exit(1);
}
printf("Incoming message size = %d\n", nbytes);
int i;
for (i=0; i < nbytes; i++)
printf("%02x ", ((unsigned char) msgbuf[i]));
printf("\n");
}
}
We had the same problem. With tcpdump we saw the data; however, the multicast client/listener was not picking up the data. Then we realized that the Reverse Path Filter (rp_filter) was rejecting the packets.
After disabling the rp-filter, the client/listener application started picking up the packets. Use the below command to disable rp_filter:
echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
In the above, replace 'eth0' with the interface receiving the multicast if other than eth0
To my knowledge, you can't do this on the same box ,tcpreplay bypasses the host's
routing table and sends traffic out the interface.
you have to start your listener on a different box. and make sure multicast is enabled. because by default, switch discards multicast traffic.
In my case I needed to adjust the pcap file by setting the correct destination MAC address. Also the checksum should be recalculated. And yes, 2 hosts are required for "tcpreplay". Without these I was fighting for a long time but only "tcpdump" showed the replayed stream, not my multicast listening app :(
This is just a theory, but it might be that the packets are discarded by the receiving side due to their checksums being wrong.
That could happen if the machine where you run tcpdump has IP or UDP checksum offloading enabled. That means the packages you capture locally haven't their checksums calculated yet, which the hardware does before sending them out. When you then tcpreplay those packets, the checksums are not calculated, as tcpreplay works on a lower level than the socket API you used to generate the packets.
In order to verify the correctness of the checksums (both those of the dump file as well as those of the packets spit out by the subsequent tcpreplay), tcpdump -v ... will warn you about wrong checksums. wireshark also colors wrongly checksummed frames differently (unless turned off in the wireshark settings).
Did you try to tcpdump the packets only on the sending host, or also on the receiving host? The latter would remove the checksum errors, if that is indeed your problem.
In Windows (I write it because in topic name you not specify that is not Windows) there is problem like this with different programs. But this program works fine Colasoft Packet Player. First time you should start it with administrative privileges.
OR (for all possible systems) you can try check this list.
Can I join the party?
Now, it is mentioned clearly on the FAQ page.
https://tcpreplay.appneta.com/wiki/faq.html#can-i-send-packets-on-the-same-computer-running-tcpreplay
Q: Can I send packets on the same computer running tcpreplay?
Generally speaking no. When tcpreplay sends packets, it injects them
between the TCP/IP stack of the system and the device driver of the
network card. The result is the TCP/IP stack system running tcpreplay
never sees the packets.
One suggestion that has been made is using something like VMWare,
Parallels or Xen. Running tcpreplay in the virtual machine (guest)
would allow packets to be seen by the host operating system.