Skip to content

Commit

Permalink
Merge pull request #24 from apernet/wip-porthop-with-redirect
Browse files Browse the repository at this point in the history
Port hopping with REDIRECT instead of DNAT
  • Loading branch information
haruue authored Jun 16, 2024
2 parents 9c63458 + 44a22b2 commit 5b42035
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/docs/advanced/Port-Hopping.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The Hysteria server does not have built-in support for listening on multiple por
```bash
# IPv4
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j DNAT --to-destination :443
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
# IPv6
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j DNAT --to-destination :443
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
```

=== "nftables"
Expand All @@ -53,7 +53,7 @@ The Hysteria server does not have built-in support for listening on multiple por
table inet hysteria_porthopping {
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter dnat to :$HYSTERIA_SERVER_PORT
iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter redirect to :$HYSTERIA_SERVER_PORT
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/advanced/Port-Hopping.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Hysteria 服务端并不能同时监听多个端口,因此不能在服务器
```bash
# IPv4
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j DNAT --to-destination :443
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
# IPv6
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j DNAT --to-destination :443
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
```

=== "nftables"
Expand All @@ -53,7 +53,7 @@ Hysteria 服务端并不能同时监听多个端口,因此不能在服务器
table inet hysteria_porthopping {
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter dnat to :$HYSTERIA_SERVER_PORT
iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter redirect to :$HYSTERIA_SERVER_PORT
}
}
```
Expand Down

0 comments on commit 5b42035

Please sign in to comment.