2
I am experiencing an interesting issue that I am struggling to get to the bottom of and would welcome any insights into what might be going on.
I am running a Macbook pro on OSX 10.13.6.
My issue is as follows... I start up a node server binding to all interfaces through the 0.0.0.0
address. I am able to Curl localhost:3000
and 127.0.0.1:3000
and successfully hit the server and receive a response.
When I try to curl my private IP from my machine curl 192.168.1.113:3000
the request is received by the server and a response is sent, however, the response is never received by curl. Colleagues on the network are successfully able to curl my private IP and get a response.
Here is what I have observed so far.
I flush my routing tables netstat -rn
looks like this.
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 74 0 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 3 1561554184 lo0
169.254 link#12 UCS 0 0 en0
192.168.1 link#12 UCS 0 0 en0
192.168.1.1/32 link#12 UCS 1 0 en0
192.168.1.1 70:4f:57:81:72:d2 UHLWIir 24 37 en0 1198
192.168.1.113/32 link#12 UCS 0 0 en0
224.0.0/4 link#12 UmCS 2 0 en0
224.0.0.251 1:0:5e:0:0:fb UHmLWI 0 0 en0
239.255.255.250 1:0:5e:7f:ff:fa UHmLWI 0 2 en0
255.255.255.255/32 link#12 UCS 0 0 en0
My private IP has a record 192.168.1.113/32 that is bound to the en0 interface. When I access the server using curl on localhost and 127.0.0.1 nothing changes in my routing tables.
Immediately after accessing curl 192.168.1.113:3000
from my machine a new record appears in the routing table as shown below.
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 71 0 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 5 1561554801 lo0
169.254 link#12 UCS 0 0 en0
192.168.1 link#12 UCS 1 0 en0
192.168.1.1/32 link#12 UCS 1 0 en0
192.168.1.1 70:4f:57:81:72:d2 UHLWIir 22 43 en0 1170
192.168.1.113/32 link#12 UCS 1 0 en0
192.168.1.113 88:e9:fe:4c:a3:58 UHLWIi 2 8 lo0
192.168.1.255 ff:ff:ff:ff:ff:ff UHLWbI 0 11 en0
224.0.0/4 link#12 UmCS 2 0 en0
224.0.0.251 1:0:5e:0:0:fb UHmLWI 0 0 en0
239.255.255.250 1:0:5e:7f:ff:fa UHmLWI 0 18 en0
255.255.255.255/32 link#12 UCS 0 0 en0
The line has a gateway interface which is the en0 interface and is bound to lo0 the loopback interface.
192.168.1.113 88:e9:fe:4c:a3:58 UHLWIi 2 8 lo0
I'm wondering if the response packets are being routed in a bad way when the request is being made from inside the host. All help appreciated.
EDIT -> ifconfig below
ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
XHC0: flags=0<> mtu 0
XHC1: flags=0<> mtu 0
XHC20: flags=0<> mtu 0
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether 32:00:f0:81:a8:01
media: autoselect <full-duplex>
status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether 32:00:f0:81:a8:00
media: autoselect <full-duplex>
status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether 32:00:f0:81:a8:05
media: autoselect <full-duplex>
status: inactive
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether 32:00:f0:81:a8:04
media: autoselect <full-duplex>
status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 88:e9:fe:4c:a3:58
inet6 fe80::a5:7168:25d:73ec%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.1.113 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether 0a:e9:fe:4c:a3:58
media: autoselect
status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
ether a2:cf:3c:7c:70:56
inet6 fe80::a0cf:3cff:fe7c:7056%awdl0 prefixlen 64 scopeid 0xe
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether 32:00:f0:81:a8:01
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: en1 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 8 priority 0 path cost 0
member: en2 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 9 priority 0 path cost 0
member: en3 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 10 priority 0 path cost 0
member: en4 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 11 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::61db:32d6:4611:1341%utun0 prefixlen 64 scopeid 0x10
nd6 options=201<PERFORMNUD,DAD>
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether ac:de:48:00:11:22
inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x7
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
Server can be started in Node
require('http')
.createServer(function (req, res) {
res.end('OK');
})
.listen(3000, '0.0.0.0');
or Python 2
python -m SimpleHTTPServer 3000
Can you provide an ifconfig output. I've got an inkling of the issue but need to confirm the interface configuration. – Hogstrom – 2018-08-02T12:20:08.517
Hi @hogstrom I've added the ifconfig to the post. Thanks. – Simon McClive – 2018-08-03T12:34:46.700
Two things. Thanks for the ifconfig. Do you have your node js code in a form that you can share how your setting up the listen? Are you binding to "0.0.0.0". What's odd is that there is another entry that I don't understand.
192.168.1.113 88:e9:fe:4c:a3:58 UHLWIi 2 8 lo0
This shows your IP is bound to the loopback. This is odd to me at least I've never seen it. Can you provide a snippet of code so I can re-produce ?
Can you do this command as well so we can see what the IP the app is bound to?
netstat -an -f inet -p tcp | grep LISTEN
– Hogstrom – 2018-08-05T02:31:30.773I've moved networks but same issue. Netstat output
192.168.0.27/32 link#12 UCS 1 0 en0
and192.168.0.27 88:e9:fe:4c:a3:58 UHLWIi 1 29 lo0
for port 3000 the only record is thistcp4 0 0 *.3000 *.* LISTEN
. Added node/python code above, both are binding to 0.0.0.0. – Simon McClive – 2018-08-06T07:25:41.540You have a very strange network setup, which very likely is the reason. Are you responsible for your network, or is it some other person? A normal setup would have some /24 or other address range on
en0
instead of single /32 addresses, and a complete LAN segment behind it, and it never would have the same address onlo
. Is your network in any way special, or why did you end up with this setup? – dirkt – 2018-08-06T08:31:52.623