eMule high ID (iptables + Open???)

Given WAN interface of a VPS node : enp1s0(45.77.43.22/23), Open??? interface tun0(10.8.0.1/24), an Open??? client IP address is 10.8.0.2/24, which is running eMule. How can I publicize tcp://10.8.0.2:24662 and udp://10.8.0.2:24672?

To publicize tcp://10.8.0.2:24662 and udp://10.8.0.2:24672 from your Open??? client running eMule, you can use port forwarding through iptables to map those ports on the VPS's WAN interface (enp1s0) to the Open??? client's IP (10.8.0.2). Here's how to set it up:

  1. Forward TCP Port 24662:

    Run this command to forward TCP traffic on enp1s0 (VPS WAN interface) at port 24662 to the Open??? client (10.8.0.2):

    sudo iptables -t nat -A PREROUTING -i enp1s0 -p tcp --dport 24662 -j DNAT --to-destination 10.8.0.2:24662
    
  2. Forward UDP Port 24672:

    Run this command to forward UDP traffic on enp1s0 at port 24672 to the Open??? client (10.8.0.2):

    sudo iptables -t nat -A PREROUTING -i enp1s0 -p udp --dport 24672 -j DNAT --to-destination 10.8.0.2:24672
    
  3. Enable IP Forwarding:

    Ensure that IP forwarding is enabled on your VPS by checking the /proc/sys/net/ipv4/ip_forward value:

    sudo sysctl -w net.ipv4.ip_forward=1
    

    To make this permanent, add or update the following line in /etc/sysctl.conf:

    net.ipv4.ip_forward = 1
    
  4. Configure MASQUERADE for Outbound Traffic:

    Add a MASQUERADE rule to handle the outbound traffic from the Open??? network:

    sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o enp1s0 -j MASQUERADE
    

These steps will forward external requests on ports 24662 (TCP) and 24672 (UDP) to your Open??? client (10.8.0.2), making the eMule service accessible publicly via 45.77.43.22:24662 (TCP) and 45.77.43.22:24672 (UDP).

To verify, you can check the iptables rules:

sudo iptables -t nat -L -v -n --line-num

Addition settings:

Allow TCP/UDP inbound/outbound traffic:

sudo /sbin/ip6tables -L OUTPUT -v --line-numbers
sudo /sbin/ip6tables -I OUTPUT 1 -p tcp --sport 24662 -j ACCEPT
sudo /sbin/ip6tables -I OUTPUT 2 -p udp --sport 24672 -j ACCEPT

sudo /sbin/iptables -L INPUT -v --line-numbers
sudo /sbin/iptables -I INPUT 1 -p tcp --dport 24662 -j ACCEPT
sudo /sbin/iptables -I INPUT 1 -p udp --dport 24672 -j ACCEPT

Remove redundant iptables rules:

sudo iptables -t nat -L PREROUTING --line-numbers -v -n
sudo iptables -t nat -D PREROUTING 35

sudo iptables -t nat -L POSTROUTING --line-numbers -v -n
sudo iptables -t nat -D POSTROUTING 2

sudo apt-get install netfilter-persistent
sudo netfilter-persistent save

xxx@vultr:~/Downloads$ sudo iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
79 4390 DNAT tcp -- enp1s0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:24662 to:10.8.0.2:24662
6986 538K DNAT udp -- enp1s0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:24672 to:10.8.0.2:24672
10 568 DNAT tcp -- enp1s0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:10647 to:10.8.0.4:10647
339 26148 DNAT udp -- enp1s0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:10523 to:10.8.0.4:10523

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
26591 3302K MASQUERADE all -- * enp1s0 10.8.0.0/24 0.0.0.0/0

Remove rules

sudo iptables -t nat -D PREROUTING -p udp --dport 34665 -i enp1s0 -j DNAT --to-destination 10.8.0.4:34665

/usr/local/bin/amuled -f -p /home/linuxuser/.aMule/amuled.pid

posted @ 2025-07-13 14:22  zhanghui_ming  阅读(52)  评论(1)    收藏  举报