Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [iptables-redirect]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
15 views

Redirect socks to another interface with nftable

I want to redirect the tcp port to interfaceX , to new destination : ip 192.168.3.8 on interfaceY with nftable rules. I tried that: nft flush ruleset nft add table ip nat nft add chain ip nat ...
python3.789's user avatar
0 votes
1 answer
10 views

Inquiry on how to set up the bypass function through 2 lan ports in a pc

I have 2 LAN ports on the server (eth0, eth1). I want to export the packet that came from eth0 to eth1. Additionally, I want to make it work in the opposite direction at the same time. Is it possible?
Yong Jung Jeon's user avatar
1 vote
2 answers
62 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: ...
Waldon's user avatar
  • 11
1 vote
0 answers
107 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 ...
Patryk's user avatar
  • 14.3k
0 votes
2 answers
62 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 ...
djoker16's user avatar
0 votes
1 answer
852 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 -...
Nicola's user avatar
  • 1
0 votes
0 answers
30 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 ...
The Quantum Physicist's user avatar
0 votes
1 answer
593 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 ...
Luigis94's user avatar
0 votes
1 answer
655 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....
TheDomis4's user avatar
0 votes
1 answer
366 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. # ...
Wilhelm de Fheur Gorm's user avatar
0 votes
1 answer
202 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 -...
Modestas's user avatar
0 votes
0 answers
194 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 ...
Lusani's user avatar
  • 1
0 votes
0 answers
219 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 ...
rusokiwi's user avatar
-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 ...
tonyvas's user avatar
0 votes
1 answer
157 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 ...
KoyaCho's user avatar
  • 31
0 votes
1 answer
300 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 ...
Cirex's user avatar
  • 1
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... ...
MadHatter's user avatar
  • 153
3 votes
1 answer
630 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: +----------------------...
nicop's user avatar
  • 51
0 votes
1 answer
654 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 ...
izphi78's user avatar
0 votes
1 answer
2k 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 ...
Fco Javier Balón's user avatar
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 ...
sjaak's user avatar
  • 604
4 votes
1 answer
1k 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 ...
George Robinson's user avatar
0 votes
1 answer
543 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 ...
George Robinson's user avatar
3 votes
1 answer
6k 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 ...
iptable_warrior's user avatar
1 vote
1 answer
371 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 ...
taurled's user avatar
  • 11
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 ...
0xtuytuy's user avatar
  • 113
1 vote
0 answers
478 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 ...
Simply_Me's user avatar
  • 1,752
0 votes
0 answers
714 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 ...
Tiago Pimenta's user avatar
1 vote
1 answer
337 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 ...
guest723561's user avatar
1 vote
1 answer
565 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 ...
MrLimo's user avatar
  • 11
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. ...
IdanE's user avatar
  • 1
2 votes
1 answer
17k 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....
user337738's user avatar
0 votes
0 answers
746 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 ...
a06e's user avatar
  • 1,747
5 votes
1 answer
3k 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 ...
Shadur-don't-feed-the-AI's user avatar
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 ...
SRNB's user avatar
  • 31
1 vote
2 answers
1k 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 ...
Eduardo Lucio's user avatar
0 votes
1 answer
219 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 ...
Kaizu's user avatar
  • 1
1 vote
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 ...
Satnam Sandhu's user avatar
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: ...
Evgeniy's user avatar
  • 11
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 <-- ...
Pierre C's user avatar
  • 103
1 vote
2 answers
589 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 ...
thanos's user avatar
  • 123
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 ...
Dudus's user avatar
  • 31
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 ...
thanos's user avatar
  • 123
12 votes
2 answers
10k 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 ...
Lapsio's user avatar
  • 1,323
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 ...
artaxerxe's user avatar
  • 473
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 ...
nmnir's user avatar
  • 123
1 vote
0 answers
622 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 ...
amam's user avatar
  • 13
0 votes
0 answers
208 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 -...
johne's user avatar
  • 121
2 votes
0 answers
206 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 ...
cyprian's user avatar
  • 131
2 votes
0 answers
790 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 ...
J. Doe's user avatar
  • 131