Local port forwarding using iptables is not working

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
I am using the following command to forward incoming traffic from port 30 to port 1234. But it's not working. In Wireshark also there is no trace of packets directing to port 1234 are found.
sudo iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p tcp --dport 30 -j REDIRECT --to-ports 1234.
linux-mint iptables iptables-redirect
add a comment |Â
up vote
0
down vote
favorite
I am using the following command to forward incoming traffic from port 30 to port 1234. But it's not working. In Wireshark also there is no trace of packets directing to port 1234 are found.
sudo iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p tcp --dport 30 -j REDIRECT --to-ports 1234.
linux-mint iptables iptables-redirect
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using the following command to forward incoming traffic from port 30 to port 1234. But it's not working. In Wireshark also there is no trace of packets directing to port 1234 are found.
sudo iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p tcp --dport 30 -j REDIRECT --to-ports 1234.
linux-mint iptables iptables-redirect
I am using the following command to forward incoming traffic from port 30 to port 1234. But it's not working. In Wireshark also there is no trace of packets directing to port 1234 are found.
sudo iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p tcp --dport 30 -j REDIRECT --to-ports 1234.
linux-mint iptables iptables-redirect
asked Jul 20 at 8:16
SRNB
1
1
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30
add a comment |Â
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
check if this is enabled or not by
sudo iptables -t nat -L
If There are any entries , delete them using:
sudo iptables -F -t nat
Try without src dest flags:
sudo iptables -t nat -A PREROUTING -p tcp --dport 30 -j REDIRECT --to-ports 1234
check again if this is enabled or not by
sudo iptables -t nat -L
It is Important to remove chained entries queued by default to "OUTPUT" route.
Hope This helps!!
add a comment |Â
up vote
0
down vote
Local forwarding of packets different port doesn't pass through PREROUTING chain. They follow the OUTPUT chain. Changing the chain from PREROUTING TO OUTPUT works.
sudo iptables -t nat -A OUTPUT -p tcp --dport 30 -j REDIRECT --to-port 1234.
More details can be found here about the iptables NAT Filtershttps://www.karlrupp.net/en/computer/nat_tutorial
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
check if this is enabled or not by
sudo iptables -t nat -L
If There are any entries , delete them using:
sudo iptables -F -t nat
Try without src dest flags:
sudo iptables -t nat -A PREROUTING -p tcp --dport 30 -j REDIRECT --to-ports 1234
check again if this is enabled or not by
sudo iptables -t nat -L
It is Important to remove chained entries queued by default to "OUTPUT" route.
Hope This helps!!
add a comment |Â
up vote
0
down vote
check if this is enabled or not by
sudo iptables -t nat -L
If There are any entries , delete them using:
sudo iptables -F -t nat
Try without src dest flags:
sudo iptables -t nat -A PREROUTING -p tcp --dport 30 -j REDIRECT --to-ports 1234
check again if this is enabled or not by
sudo iptables -t nat -L
It is Important to remove chained entries queued by default to "OUTPUT" route.
Hope This helps!!
add a comment |Â
up vote
0
down vote
up vote
0
down vote
check if this is enabled or not by
sudo iptables -t nat -L
If There are any entries , delete them using:
sudo iptables -F -t nat
Try without src dest flags:
sudo iptables -t nat -A PREROUTING -p tcp --dport 30 -j REDIRECT --to-ports 1234
check again if this is enabled or not by
sudo iptables -t nat -L
It is Important to remove chained entries queued by default to "OUTPUT" route.
Hope This helps!!
check if this is enabled or not by
sudo iptables -t nat -L
If There are any entries , delete them using:
sudo iptables -F -t nat
Try without src dest flags:
sudo iptables -t nat -A PREROUTING -p tcp --dport 30 -j REDIRECT --to-ports 1234
check again if this is enabled or not by
sudo iptables -t nat -L
It is Important to remove chained entries queued by default to "OUTPUT" route.
Hope This helps!!
edited Jul 20 at 8:39
answered Jul 20 at 8:32
Pavan Kate
263
263
add a comment |Â
add a comment |Â
up vote
0
down vote
Local forwarding of packets different port doesn't pass through PREROUTING chain. They follow the OUTPUT chain. Changing the chain from PREROUTING TO OUTPUT works.
sudo iptables -t nat -A OUTPUT -p tcp --dport 30 -j REDIRECT --to-port 1234.
More details can be found here about the iptables NAT Filtershttps://www.karlrupp.net/en/computer/nat_tutorial
add a comment |Â
up vote
0
down vote
Local forwarding of packets different port doesn't pass through PREROUTING chain. They follow the OUTPUT chain. Changing the chain from PREROUTING TO OUTPUT works.
sudo iptables -t nat -A OUTPUT -p tcp --dport 30 -j REDIRECT --to-port 1234.
More details can be found here about the iptables NAT Filtershttps://www.karlrupp.net/en/computer/nat_tutorial
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Local forwarding of packets different port doesn't pass through PREROUTING chain. They follow the OUTPUT chain. Changing the chain from PREROUTING TO OUTPUT works.
sudo iptables -t nat -A OUTPUT -p tcp --dport 30 -j REDIRECT --to-port 1234.
More details can be found here about the iptables NAT Filtershttps://www.karlrupp.net/en/computer/nat_tutorial
Local forwarding of packets different port doesn't pass through PREROUTING chain. They follow the OUTPUT chain. Changing the chain from PREROUTING TO OUTPUT works.
sudo iptables -t nat -A OUTPUT -p tcp --dport 30 -j REDIRECT --to-port 1234.
More details can be found here about the iptables NAT Filtershttps://www.karlrupp.net/en/computer/nat_tutorial
answered Jul 24 at 7:35
SRNB
1
1
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457375%2flocal-port-forwarding-using-iptables-is-not-working%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Look at the kernel ip forwarding settings i.e. by running the command "sysctl -ar forward" Make sure that the relevant settings are enabled. For example, if you are using IP version 4, ensure that "net.ipv4.conf.all.forwarding" is set to 1
â Raman Sailopal
Jul 20 at 9:16
Yes. net.ipv4.ip_forward is also set to 1 and also uncommented at the system variable file(/etc/sysctl.conf) to allow forwarding. But still doesn't seem to work.
â SRNB
Jul 20 at 11:30