0

I have the following network topology: N devices in the network, one is a gateway. All of them are in the same network. My goal is to use one device as a proxy for UDP packets.

for example i will have in the network the following devices:

GW: 192.168.1.1
D1: 192.168.1.20
D2: 192.168.1.21
D3: 192.168.1.22
D4: 192.168.1.23
...

GW - Runs a DHCP Server assigning every device an address.

D1 - Runs a tftp client

D2...N - All run tftp servers

My goal is to route the D1 requests to one of the D2...N devices though the GW. For example let's say i want to connect the tftp client D1 to the tftp server D4 but D1 should not know which device it connects to, i want to send the tftp connection request to the gateway, and then the gateway should route the request to D4 in this case.

Something like D1 -> GW -> D4 and back.

Now i've tried with the following rules on the gateway but i can't seem to get the connection working.

sudo iptables -t nat -A PREROUTING -s 192.168.1.20 -p udp --dport 69 -j DNAT --to-destination 192.168.1.23:69
sudo iptables -t nat -A POSTROUTING -p udp -d 192.168.1.23 --dport 69 -j SNAT --to-source 192.168.1.20       
iptables -A FORWARD -d 192.168.1.23 -p tcp --dport 69 -j ACCEPT                                               

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.