D
Deleted member 19827
Guest
Hi there
I would like to forward port 53 to 1194 (UDP/OpenVPN) with iptables. I applied these same steps in an earlier version of Asuswrt-Merlin and it worked without any problems. After upgrading to a recent version it stopped to work. The iptable rule doesn't seem to be applied.
____________________________________
My configuration:
Device: Asus RT-AC66U
Firmware: 376.45 (Asuswrt-Merlin)
OpenVPN: Listening on port 1194 UDP, works
____________________________________
Autostart script install steps:
cd /jffs/scripts/
vi firewall-start
<INSERTED>
#!/bin/sh
iptables -t nat -A PREROUTING -p udp -d $(nvram get wan0_ipaddr) -i $(nvram get wan0_ifname) --dport 53 -j REDIRECT --to-port 1194
</INSERTED>
Note: $(nvram get wan0_ifname) = eth0
chmod a+rx /jffs/scripts/*
. firewall-start
After running the script or the command manually will not return any error message.
____________________________________
iptables config after running the command:
admin@RT-AC66U:/tmp/home/root# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT udp -- anywhere anywhere udp dpt:1194
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere state NEW
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
DROP all -- anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere
DROP icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate DNAT
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain FUPNP (0 references)
target prot opt source destination
Chain PControls (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain logaccept (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `ACCEPT '
ACCEPT all -- anywhere anywhere
Chain logdrop (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `DROP '
DROP all -- anywhere anywhere
____________________________________
Any help is highly appreciated.
Best regards
DR_HAMMER
I would like to forward port 53 to 1194 (UDP/OpenVPN) with iptables. I applied these same steps in an earlier version of Asuswrt-Merlin and it worked without any problems. After upgrading to a recent version it stopped to work. The iptable rule doesn't seem to be applied.
____________________________________
My configuration:
Device: Asus RT-AC66U
Firmware: 376.45 (Asuswrt-Merlin)
OpenVPN: Listening on port 1194 UDP, works
____________________________________
Autostart script install steps:
cd /jffs/scripts/
vi firewall-start
<INSERTED>
#!/bin/sh
iptables -t nat -A PREROUTING -p udp -d $(nvram get wan0_ipaddr) -i $(nvram get wan0_ifname) --dport 53 -j REDIRECT --to-port 1194
</INSERTED>
Note: $(nvram get wan0_ifname) = eth0
chmod a+rx /jffs/scripts/*
. firewall-start
After running the script or the command manually will not return any error message.
____________________________________
iptables config after running the command:
admin@RT-AC66U:/tmp/home/root# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT udp -- anywhere anywhere udp dpt:1194
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere state NEW
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
DROP all -- anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere
DROP icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate DNAT
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain FUPNP (0 references)
target prot opt source destination
Chain PControls (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain logaccept (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `ACCEPT '
ACCEPT all -- anywhere anywhere
Chain logdrop (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `DROP '
DROP all -- anywhere anywhere
____________________________________
Any help is highly appreciated.
Best regards
DR_HAMMER
Last edited by a moderator: