Tor can be very slow, and eventually Start9 will support clearnet options. But until it does, here’s how to get your Core Lightning to accept direct IPv4 connections.
Step 1: Expose your Core Lightning to local LAN
Credit to remcoros for the code.([DIY] Exposing electrs and bitcoind over LAN in StartOS 0.3)
Login to StartOS over SSH and switch to the root user:
sudo -i
Run the following command to switch to the “chrooted” environment, any system changes made now will be persisted across reboots.
/usr/lib/startos/scripts/chroot-and-upgrade
Paste the following, this will install ‘socat’ and a new systemd service responsible for port forwarding 9735 for c-lightning
apt install socat -y
cat > /lib/systemd/system/socat.c-lightning.service <<'EOL'
[Unit]
Description=socat c-lighting forward
Wants=docker.service
After=docker.service
[Service]
Type=simple
Restart=always
RestartSec=3
ExecStartPre=/bin/bash -c "/bin/systemctl set-environment IP=$(ip route | grep default | awk '{print $9}')"
ExecStart=/usr/bin/socat tcp-l:9735,fork,reuseaddr,su=nobody,bind=${IP} tcp:c-lightning.embassy:9735
[Install]
WantedBy=multi-user.target
EOL
systemctl enable socat.c-lightning
Now exit the chroot environment. Note: this will reboot StartOS!
exit
After lightning-cli starts, your node will be accessible directly via IP on your local network.
Step 2: Expose your node to WAN/Internet
Next step is to expose it to the web. The following is an example, and will make you NO LONGER ANONYMOUS. Use a VPN if you wish to remain anonymous.
Look up your StartOS IPv4 address. You’ll find it under System > About. For example 192.168.1.123
Log into your router and follow your router’s instructions to set up port forwarding, setting incoming connection on port 9735 to point to your StartOS IP (eg. 192.168.1.123)
Now other nodes can connect directly to your node without needing to use Tor. But only if they know how (you tell them your IP yourself).
Step 3: Add announce settings to let other nodes find you
Login to StartOS over SSH
Edit your C Lightning config file
sudo nano /embassy-data/package-data/volumes/c-lightning/data/main/config.main
Add the following line to your configuration, replacing the IP with whatever IP number your node is reachable through. This is either your WAN IP if you exposed it on your router in Step 2, or your VPN IP number if you set that up
announce-addr=74.63.52.41:9735
Don’t forget the port at the end.
CTRL-X and Y to exit and save. Restart Core Lightning, and now your node should be broadcasting both Tor and IPv4 connections. To check, log into your c-lightning instance
sudo podman exec -ti c-lightning.embassy bash
then run the following command (once your Core Lightning is fully up and running)
lightning-cli getinfo
You should see “type”: “torv3”, “address”: and your Tor address that you had previously, but now you should also see another entry “type”: “ipv4”,“address”: and your new IP address.
After a while you should also see this reflected in online node explorers like amboss and mempool. Though some (amboss) take a long time to update.