I am trying to expose port 8545 on a local geth client for use with MetaMask on Chrome 83.0.4103.106 (x86_64), using a Windows host (10.0.18362.900). I store all my blockchain data on a separate drive, R:. I use
geth --datadir=R:\geth --rpc --rpccorsdomain "*" --rpcaddr 127.0.0.1 --rpcapi "eth,web3" --rpcport 8545 to start the full node. IPC connections work normally, and I can see that geth outputs:
INFO [06-21|17:52:34.051] Mapped network port proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1) INFO [06-21|17:52:34.059] Mapped network port proto=udp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1)
However, I do not see the same thing for port 8545. No matter which options I tried or omitted, and also while trying to run as administrator, 8545 always remains closed (when checked with
nmap). This means that I am unable to access the node through MetaMask. I have already tried changing
http. since the flags are deprecated, but this did not have any effect. I have also tried to specify "Custom RPC" in MetaMask and use my local IP address instead of 127.0.0.1. Is there any way to explicitly tell geth to map 8545 as a TCP port?
I would also like to note that geth doesn't recognize that I specified 127.0.0.1, ignores the option, and proceeds to use my local IP. See:
INFO [06-21|17:52:34.016] HTTP endpoint opened url=http://192.168.86.36:8545/ cors=* vhosts=localhost
Geth is done with IBD and is only about 100 blocks behind, with 10 peers connected.