Traffic Forward
This is a tool that allows you to easily create traffic forwarding rules through this command, which is implemented through the iptables tool.
What is this
It create TCP/UDP rules for three chains:
# Chians: PREROUTING、POSTROUTING、FORWARD
Equivalent to:
# 192.168.17.131 is the server host's IP address, automatically fetched.
Prerequisite
- Must be a Linux operating environment.
- Iptables is already installed (most systems will default to installation).
- The server has enabled traffic forwarding.【95% of people did not take this step】
- The server already has a
Rustenvironment.
How to enable server to enable traffic forwarding
Just for your reference, the ideas are the same
# A value of 0 indicates that the forwarding function is not activated, while a value of 1 means it is activated.
cat /proc/sys/net/ipv4/ip_forward
# Temporarily enable forwarding function
echo 1 > /proc/sys/net/ipv4/ip_forward
illustrate
This tool only replaces writing iptables rules and solves multiple configurations with one command. As iptables is used, root account operations are required.
Installation
Upon successful installation, you will see the following path:
)
)
【Non-root Account】 Add a soft link to /usr/bin:
# This is only for your reference, please operate according to your actual path
View version:
Or:
Usage
- Add forwarding:
# Use local port 5555 to forward to 192.102.11.44:8000
- List of existing rules:
- Query traffic consumption for a specific IP:
- Delete forwarding rule for a specific IP:
- Enable the wep interface:
# traffic_forward web <token> [port]
Enable the wep interface
# traffic_forward web <token> [port]
Add
- uri: iptables/add
- method: post
- request
{
}
- response
{
}
Delete
- uri: iptables/del
- method: post
- request
- response
List
- uri: iptables/list
- method: get
- request: empty (change next version will)
- response
Usage examples
# When use API
# Request test
}}}
License
MIT OR Apache-2.0