Questions tagged [iptables-redirect]
The iptables-redirect tag has no usage guidance.
67
questions
1
vote
2
answers
50
views
SSH connection from internet through server1 (on internet) to local server2(not on internet)
I got some pain to solve the following problem and I would appreciate some help.
I have:
Server1 connected to the internet and connected on LAN1 (Debian)
Public IP: xx.xx.xx.xx
Private IP on LAN1: ...
1
vote
0
answers
62
views
How to forward packets between net namespaces?
I have a lima VM with linux running Ubuntu 23.04 with kernel 6.2 and cgroupsv2. This VM is meant to serve as docker host. When I create docker network in this VM I get an interface in its own ...
0
votes
0
answers
11
views
Make a Wi-Fi emitting device visible on another network
I have a raspberry pi connected by wifi to a sensor (network A) that emits its own Wi-Fi signal and that is controlled from an Android application on a device connected to the Wi-Fi that emits the ...
0
votes
2
answers
47
views
Any way to redirect/tunnel HTTP stream from LAN1 to LAN2 through Raspberry?
I have a usual local (192.168.1.x) network with multiple devices and the router with internet connection.
One of the devices is a Raspberry (192.168.1.2) connected via WiFi. It also connected to the ...
0
votes
1
answer
458
views
IPtables UDP port PREROUTING not working
On Ubuntu 22.04 I am trying to render the incoming traffic of a certain port to another ip address.
I have redirected several TCP ports with this command and they all work correctly:
iptables -t nat -...
0
votes
0
answers
24
views
How can I isolate my firewall rules in a chain such that I can reset them separately?
I've been running some iptables rules for a while, which are (I hope) fine, no issues so far. Here's a snippet of that
# Block all input and forward traffic, both IPv4 and IPv6
iptables -P INPUT DROP
...
0
votes
1
answer
446
views
How can I copy all traffic on a network and forward it to another IP address?
I'm trying to use iptables.
I'm simulating a network with Mininet. I currently have a router connecting two subnets (10.0.1.1/24 and 10.0.2.1/24). If I use these two iptables rules on the router I see ...
0
votes
1
answer
454
views
Forward a request from Server A to Server B by Port
i'm not sure about the right terminology, but try to redirect Traffic from Server A to Server B. I have the following Resources:
A DNS Record Type A pointing to the Server A's IP address, e.g.: abc....
0
votes
1
answer
308
views
lxc containers can ping host and can resolve dns internet addresses but cannot get to the internet
Debian Buster amd64
Two containers, 192.168.122.2,3 both can resolve but cannot get to the Internet
Both containers can ping / interact with the host server.
Here is what I have in iptables.
# ...
0
votes
1
answer
181
views
Iptables forward port traffic to another port with byte calculation
Problem
I want to 'redirect' traffic from one port to another. But I need to be able to calculate how much INPUT AND OUTPUT bytes were used in communicating through that port.
Half Solution
iptables -...
0
votes
0
answers
175
views
Re-write source IP to vlan tagged IP
My setup is as follows:
PC1: IP of normal interface 10.0.0.11
IP of vlan interface 11.0.0.11
PC2: IP of normal interface 10.0.0.12
IP of vlan interface 11.0.0.12
I can ping 11.0.0.12 with no ...
0
votes
0
answers
199
views
iptables routing on multiple virtual interfaces
I have 1.1.1.1 outside, which is the public interface of vm1 in azure. VM1 has 192.168.1.1 an internal IP. In addition there's also 1.1.1.2 (virtual) which is attached to the same interface and is ...
-1
votes
1
answer
1k
views
Forwarding ports from one device to another, on different networks
My network setup consists of 3 computers (devices A, B, C).
Devices A, B, and C are connected through ethernet using a switch.
Only device A has internet access (wifi router, with ports 8000-8002 ...
0
votes
1
answer
148
views
Rerouting incoming packets from server to local machine B instead of A
I'm trying to redirect a server's incoming TCP packets to local machine B.
The application client on local machine A (192.168.0.7) is connected to the server (1.2.3.4), so every incoming TCP packet ...
0
votes
1
answer
273
views
iptables chain to forward between two identical networks
I have two identical networks and I am looking to forward traffic between two computers which are configured as a TCP server and a TCP client respectively. Using a computer which is connected to both ...
2
votes
2
answers
1k
views
iptables - Drop NAT rules based on rule/name, NOT rule number
I need to script some Iptables rule changes involving NAT rules (-t nat) on Ubuntu 16 servers.
It seems like the common way to drop a rule using -D [rule here] does not work with the -t identifier... ...
3
votes
1
answer
532
views
Port forwarding with iptables and firejail sandbox
I try to run a HTTP server on port 8000 in a firejail sandbox, and make it accessible on all interfaces of the host on port 8888.
The whole system can be represented as below:
+----------------------...
0
votes
1
answer
604
views
Route IP to another network without NAT
Hey I came up with the following Problem.
At my home I got one public IPv4 and want to add IPs.
I own multiple vServers with "as many" IPs I want. So I thought about buying an additional IP and ...
0
votes
1
answer
1k
views
Changing `iptables` rules by `MAC` address
I'm using a gateway connected to VPN to do forwarding with the port of an industrial LAN element.
I use iptables forwarding to access port 80/443 of my gateway in the browser to show me the contents ...
2
votes
2
answers
4k
views
IPtables UDP port forward not working
I have a device sending UDP syslog messages to my server on port 514. I have confirmed this traffic is reaching my server by checking with ifconfig as well as running my collector software under root ...
3
votes
1
answer
985
views
Where does the packet cloned by iptables-mod-tee go after cloning?
Were does the packed cloned by iptables-mod-tee go after cloning when I add a rule like this ?:
iptables -t mangle -A POSTROUTING -o eth2 -j TEE --gateway 192.168.0.3
Please refer to the diagram ...
0
votes
1
answer
438
views
iptables-mod-tee to monitor outgoing traffic from a WAN interface
I have an OpenWrt router (v18.06.5, r7897-9d401013fc), that does a standard (out of the box) NAT between a 192.168.0.1/24 LAN (on eth1) and one public IP 140.82.118.4 (on eth2). The router has the ...
3
votes
1
answer
5k
views
Setting up UDP packets to two different destinations using iptables and PREROUTING
I am trying to send a UDP on a packet to two different external/remote IPs using iptables.
Currently I am running a command that looks like this:
iptables -t nat -A PREROUTING -i eth0 -p udp --dport ...
1
vote
1
answer
338
views
use IP tables to redirect some (ip based) traffic
I have a laptop that forwards all the traffic from one interface to another.
I followed the instruction provided for different question, and it works.
net.ipv4.ip_forward = 1
and add the following ...
1
vote
1
answer
2k
views
iptables ports redirect does not work
I am trying to setup a webserver running on localhost:8082 and redirect port 80 to it.
I have done it using the prerouting redirect nat table but it does not seem to work, the packets arrive to the ...
1
vote
0
answers
459
views
Redirect Curl Calls From Specific IP On Localhost
I've a node server that serves localhost:90, and we need to direct all curl calls from WITHIN the machine on 168.92.168.92 to localhost:90.
How can this be achieved? Would this be using iptables?
I ...
0
votes
0
answers
690
views
How to fool the bridge to redirect packages of a IP not owned by any interface
I want to redirect the traffic between interfaces over a virtual bridge, when a specific match of IP and port pass through.
For instance, when I connect to 10.20.30.40 on port 2222 inside a guest ...
1
vote
1
answer
302
views
Redirecting incoming tcp traffic back to the sender
I have created this program that runs inside a router. The program is essentially a speed test and for the upload part of the test, the program is utilising a lot CPU and generating a file inside the ...
1
vote
1
answer
533
views
IPTables and Port Forwarding on an OpenVPNAS Server
I have a new OpenVPNas server running on CentOS 7 (Not married to CentOS 7). That I working on replacing an expensive Commercial VPN that has a Public Static IP. Being that the OpenVPNas server is ...
0
votes
0
answers
1k
views
Port forwarding in Linux for UDP doesn't work
I'm trying to apply a port forward rule to forward UDP traffic from my AP on port 53 to a custom DNS server listening to 9053. I tried various calls. None of them worked. I've tried this in Kali. ...
2
votes
1
answer
15k
views
Forward all traffic to a socks5 proxy port
I followed this answer: Redirect all non-local traffic to a socks proxy
root@xxx:~# cat /proc/sys/net/ipv4/ip_forward
1
root@xxx:~# netstat -tapln | grep :4545 | grep LISTEN
tcp 0 0 127....
0
votes
0
answers
858
views
Redirecting UDP to local port the reply packet isn't SNATed, w/ iptables
I ran dnscrypt-proxy or tor on Linux listning on [::]:1053 to server DNS. I wanted to make all my Linux host's DNS queries transparently use that proxy.
This is what I found from Internet how we ...
0
votes
0
answers
679
views
Transparently redirect all incoming traffic from wifi hotspot to specific port?
I am using my laptop as a wifi hotspot to share my internet connection with other devices.
My internet connection goes out through a socks proxy. In my laptop I configured redsocks to redirect all ...
5
votes
1
answer
2k
views
iptables: Change destination-IP of TEE'd packets
Because of reasons I can't go into here, I found myself having to duplicate a UDP packet stream (netflow data, if it matters) to a second destination.
After some research, I discovered that the TEE ...
1
vote
2
answers
6k
views
Local port forwarding using iptables is not working
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 ...
1
vote
2
answers
943
views
Use the LANs of one server to access the LAN of another
I'm a bit lost here, so I'm asking for your help. =D
I have three servers:
1# - LANs A and B
2# - LANs B and C
3# - LANs C and D
How can I make server 1# access through LAN B an ip that is in LAN D ...
0
votes
1
answer
213
views
iptables localhost redirect just echoes
I am trying to redirect traffic coming from the Internet into an SSH tunnel on localhost with iptables, on port 2025. For some reason the redirect doesn't work.
I connected to it with telnet and it ...
0
votes
1
answer
2k
views
Redirect all incoming and outgoing traffic from a port to a specific ip
I am running a node server inside a docker container on port 8080 and i can access it via 172.17.0.2:8080 (container ip) now i want to access this ip from localhost:9099.
I have tried using iptables ...
1
vote
0
answers
29
views
Strange behaviour of (D)NAT
I'm trying to forward all icmp requests from source ip 5.10.13.13 to new destination ip 5.10.11.11. IP of current local machine, where i'm applying iptables rule is 5.10.10.10. I apply this rule:
...
0
votes
1
answer
1k
views
How to setup ipables to redirect ports when the linux server has two IP addresses [closed]
I want my Glassfish webserver to serve web pages for two distinct IP addresses. What I am trying to do is to setup iptable rules to translate the ports.
for IP #1
198.xxx.xxx.14:80 <-- ...
1
vote
2
answers
547
views
Maintain destination port of TCP packets after leaving through another local port
problem:
I have an application sitting on a host (let's call it host1) that sends TLS-encrypted TCP packets to another host's port 5015 (let's call it host2). Due to network restrictions, the host1 ...
1
vote
1
answer
2k
views
How to Redirect marked packets on multiple ports to one IP Address
I have set up this rule:
-A PREROUTING -i vboxnet0 -p tcp -m tcp --dport 80 -j internet
-A internet -j MARK --set-xmark 0x63/0xffffffff
To capture incoming traffic on port 80 and send it to be ...
1
vote
1
answer
3k
views
iptables: transparent tcp traffic proxy
problem:
I have a TCP server and client that each listen on port 9000. I have the server and client deployed on two different hosts where traffic can only pass through port 80 between them. I want the ...
11
votes
2
answers
9k
views
What does iptables -j REDIRECT *actually* do to packet headers?
Out of curiosity I'm reading some tutorials about transparent TOR proxies as it's quite interesting topic from a networking standpoint. As opposed to VPN gateways which just use tun/tap interfaces and ...
1
vote
1
answer
1k
views
Iptables not working as I expect: response package not DNATed as expected with DNAT in PREROUTING
My server (on which bellow iptables rules are loaded) has the IP 192.168.3.110.
There is another computer in my LAN with IP 192.168.3.106.
I'm trying to redirect requests to my server on port 80 to ...
1
vote
1
answer
51
views
Linux Router for One Application using iptables
I have 3 machines:
Router 192.168.229.4
Server 192.168.229.2
Client 192.168.229.3
on the server there is a TCP file server running on port 1234. I want to redirect all the client-server-client ...
1
vote
0
answers
592
views
Squid + Squidguard - redirect http traffic
Im having trouble figuring out which is the best way to redirect the traffic for a certain subnet.
Basically i want to deny the access for a certain subnet to the internet. And i want it to always ...
0
votes
0
answers
203
views
Iptables port hijacking
I have an application listening on port 2000. I want to proxy all traffic to this port (originating locally) to a different port, say 4000.
Right now i am doing something like this.
iptables -t nat -...
2
votes
0
answers
201
views
Solus traffic flow
We install Solus in our host machines and run several containers. I've noted that after installation, solus modify iptables adding to Forward chain Solus_in and Solus_out. In those chains he is adding ...
2
votes
0
answers
781
views
iptables rules for two different lxc containers
I'm running two lxc containers onto a VPS machine and being new in iptables area Im trying to create rules to forward external traffic into containers. The first one (192.168.1.2) is running an ...