Score:0

Iptables routing port 80 to local lan machine

ni flag

I have cloud machine with public ip on eth0 and other interface zerotier have local machines with homeassistant https://192.168.0.15:8123. This cloud machine can access https://192.168.0.15:8123 over zerotier. I would like to route incoming traffic eth0 to homeassistant.

incoming public ip -> eth0 -> zerotier interface https://192.168.0.15:8123 i was trying:

sudo sysctl net.ipv4.ip_forward=1 sudo sysctl -w net.ipv4.conf.all.route_localnet=1 
sudo iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 8123 -j DNAT --to-destination 192.168.0.15:8123 
sudo iptables -A FORWARD -p tcp -d 192.168.0.15 --dport 8123 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT 

when tcpdump -i eth0 port 8123 i got incoming packets on port 8123 but nothing coming back from homeassistant

i figure it out this is working

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -A POSTROUTING -t nat -d 192.168.0.15 -j MASQUERADE
sudo iptables -A PREROUTING -t nat -p tcp --dport 8123 -j DNAT --to-destination 192.168.0.15:8123
us flag
What is the configured default gateway in homeassistant?
user129387 avatar
ni flag
thanks for trying helping me
A.B avatar
cl flag
A.B
You should either answer your own question, or delete it. Don't put the answer in the question itself.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.