> For the complete documentation index, see [llms.txt](https://book.ice-wzl.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.ice-wzl.xyz/lateral-movement/iptables-bending-traffic.md).

# IpTables bending traffic

### iptables

```
iptables -A INPUT
```

```
sudo iptables -t nat -A PREROUTING -i ens192 -s 10.10.14.221 -d 10.129.64.133 -j DNAT --to-destination 172.16.5.5
sudo iptables -t nat -A PREROUTING -i ens224 -s 172.16.5.5 -d 172.16.5.225 -j DNAT --to-destination 10.10.14.221
sudo iptables -A FORWARD -s 172.16.5.5 -d 10.10.14.221 -j ACCEPT
sudo iptables -A FORWARD -d 172.16.5.5 -s 10.10.14.221 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -d 10.10.14.221 -j SNAT --to-source 10.129.64.133
sudo iptables -t nat -A POSTROUTING -d 172.16.5.5 -j SNAT --to-source 172.16.5.225
```

```
sudo iptables -t nat -A PREROUTING -p tcp --dport 1234 -i tun0 -d 192.168.49.125 -j DNAT --to-destination 192.168.23.134
sudo iptables -t nat -A PREROUTING -i ens224 -s 172.16.5.5 -d 172.16.5.225 -j DNAT --to-destination 10.10.14.221
sudo iptables -A FORWARD -s 172.16.5.5 -d 10.10.14.221 -j ACCEPT
sudo iptables -A FORWARD -d 172.16.5.5 -s 10.10.14.221 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -d 10.10.14.221 -j SNAT --to-source 10.129.64.133
sudo iptables -t nat -A POSTROUTING -d 172.16.5.5 -j SNAT --to-source 172.16.5.225
```

```
iptables -t nat -A PREROUTING -p tcp --dport 1234 -i tun0 -d 192.168.49.125 -j DNAT --to-destination 192.168.23.134
iptables -t nat -A PREROUTING -p tcp -i eth1 -d 192.168.23.138 -j DNAT --to-destination 10.10.110.10
iptables -A FORWARD -s 10.10.110.10 -d 192.168.23.134 -j ACCEPT
iptables -A FORWARD -d 10.10.110.10 -s 192.168.23.134 -j ACCEPT
iptables -A FORWARD -i eth1 -o tun0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -d 192.168.23.134 -j SNAT --to-source 192.168.49.125
iptables -t nat -A POSTROUTING -d 10.10.110.10 -j SNAT --to-source 192.168.49.125
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.ice-wzl.xyz/lateral-movement/iptables-bending-traffic.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
