aMule Forum

English => aMule Help => Topic started by: woutermense on December 12, 2008, 04:00:31 PM

Title: xinetd to make aMuleD use a specific network interface
Post by: woutermense on December 12, 2008, 04:00:31 PM
In the xinetd manpage it says you can 'bind' a service to a specific network interface, so I've been fooling around with it a little, done some reading on the internet. But I can't seem to get it to work. Any suggestions?


---EDIT---
Never mind there's an option in the preferences to bind it already, no need to use xinetd I guess :)


---EDIT2---
Checked it and everything works like a charm. Kudos to amule again! 8)
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: woutermense on December 13, 2008, 02:28:36 AM
Something came up and I think it may be an aMule bug. But I'm not too sure. I have two network interfaces with addresses 192.168.0.1 and 192.168.0.3 . In amule.conf I have the line: Address=192.168.0.3 . But in my firewall I can still see loads of packets going out of the 192.168.0.1 interface. It seems only incoming traffic is routed to 192.168.0.3, not outgoing.

---EDIT---

I fetched a netstat for you guys:
Code: [Select]
pm12server:~ # netstat -anp | grep amuled
tcp        0      0 192.168.0.3:4712        0.0.0.0:*               LISTEN      11683/amuled
tcp        0      0 192.168.0.3:6001        0.0.0.0:*               LISTEN      11683/amuled
tcp        0      0 192.168.0.3:6001        196.203.88.136:2501     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        83.55.247.13:14715      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        87.18.74.203:3033       ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        83.98.239.79:33505      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        79.181.121.45:52743     ESTABLISHED 11683/amuled
tcp        0  59040 192.168.0.1:59405       124.64.163.22:22061     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        67.166.125.183:1249     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        75.45.113.96:3496       ESTABLISHED 11683/amuled
tcp    83220      0 192.168.0.3:6001        89.152.241.189:1536     ESTABLISHED 11683/amuled
tcp   499830      0 192.168.0.1:34737       193.137.103.29:37193    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        121.30.64.129:6373      ESTABLISHED 11683/amuled
tcp        0  25920 192.168.0.3:6001        119.96.186.235:6470     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        85.250.31.131:3146      ESTABLISHED 11683/amuled
tcp        0     18 192.168.0.3:6001        118.168.190.236:2218    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:35883       90.62.111.214:62252     ESTABLISHED 11683/amuled
tcp        0    175 192.168.0.3:6001        221.137.173.202:64374   ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        66.60.28.106:1861       ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        83.7.155.33:60096       ESTABLISHED 11683/amuled
tcp    60628      0 192.168.0.3:6001        86.75.102.103:54763     ESTABLISHED 11683/amuled
tcp   411847  40868 192.168.0.3:6001        87.205.167.207:4553     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        41.208.167.73:4353      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:33483       81.190.239.85:19079     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        190.55.38.52:1744       ESTABLISHED 11683/amuled
tcp     1147      0 192.168.0.3:6001        89.131.192.172:63901    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        124.207.99.20:20123     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        203.97.48.237:59128     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:56261       213.96.125.25:20000     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        222.172.242.84:50239    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:34145       124.90.151.19:6641      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        201.13.129.148:52358    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        85.222.86.86:46902      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        123.240.156.129:2242    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:57135       78.106.143.133:57214    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        142.177.66.95:60240     ESTABLISHED 11683/amuled
tcp        0  17680 192.168.0.1:35734       77.49.195.153:55        ESTABLISHED 11683/amuled
tcp        0  42904 192.168.0.1:35302       79.45.11.117:4662       ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:50103       212.63.206.35:4242      ESTABLISHED 11683/amuled
tcp      949      0 192.168.0.3:6001        83.37.6.235:1791        ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        88.66.153.75:62266      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        79.198.33.137:62719     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        76.171.254.111:4810     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:59550       67.240.237.63:4662      ESTABLISHED 11683/amuled
tcp        0  18720 192.168.0.1:42089       58.35.46.99:25113       ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        201.172.25.81:64557     ESTABLISHED 11683/amuled
tcp        0  24684 192.168.0.3:6001        222.82.79.223:61698     ESTABLISHED 11683/amuled
tcp        0  42720 192.168.0.1:41206       60.241.54.67:31513      ESTABLISHED 11683/amuled
tcp        0  76340 192.168.0.3:6001        219.77.80.205:41953     ESTABLISHED 11683/amuled
tcp        0    217 192.168.0.3:6001        77.127.1.161:3402       ESTABLISHED 11683/amuled
tcp        0  43800 192.168.0.3:6001        82.227.177.178:2313     ESTABLISHED 11683/amuled
tcp    66095      0 192.168.0.3:6001        87.126.200.129:1723     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        58.252.165.115:1770     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        59.105.111.115:3336     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        86.15.187.250:33685     ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        84.137.128.14:1460      ESTABLISHED 11683/amuled
tcp        0  27360 192.168.0.3:6001        58.247.194.160:34016    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        87.0.139.108:5000       ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        80.1.104.160:2092       ESTABLISHED 11683/amuled
tcp        0    127 192.168.0.3:6001        86.76.207.116:3082      ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.1:48630       195.241.254.156:4662    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        90.196.224.204:61963    ESTABLISHED 11683/amuled
tcp        0      0 192.168.0.3:6001        91.152.228.146:56139    ESTABLISHED 11683/amuled
udp        0      0 192.168.0.3:6002        0.0.0.0:*                           11683/amuled
udp        0      0 192.168.0.3:6004        0.0.0.0:*                           11683/amuled

The lines with 192.168.0.1 in them should not be there.
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: Stu Redman on December 14, 2008, 07:09:35 PM
Shouldn't your two network interfaces be on different subnets, like 192.168.0.1 and 192.168.10.3 ? Also, .1 is usually reserved for the router, don't know if it has a special meaning.
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: woutermense on December 14, 2008, 07:19:00 PM
I'm not sure, the 192.168.0.3 is just an alias. Should have mentioned it earlier, sorry about that. Anyway I set it up like this because I am trying to implement traffic shaping upstream. But the ports aMule uses are too random to set up any rules for.

---EDIT---

Some messages appear in the logfile I hadn't noticed before:
Code: [Select]
2008-12-15 04:40:09: CAUGHT DEAD SOCKET IN SENDPACKET()
 2008-12-15 04:57:30: CAUGHT DEAD SOCKET IN SENDPACKET()
 2008-12-15 05:41:17: CAUGHT DEAD SOCKET IN SENDPACKET()
 2008-12-15 07:40:15: Created Client UDP-Socket at port 6002
 2008-12-15 11:57:28: CAUGHT DEAD SOCKET IN SENDPACKET()

About the router, that's just the default configuration they usually have. I set it to 192.168.0.2
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: woutermense on December 19, 2008, 04:19:05 PM
Actually it doesn't seem to work at all anymore now. All traffic goes through the 192.168.0.1 interface. Can anyone tell me if this option is supposed to do what I want it to do?
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: Stu Redman on December 19, 2008, 04:57:06 PM
AFAIK the setting influences only the address for listening.
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: GonoszTopi on December 19, 2008, 08:45:06 PM
Binding means aMule will LISTEN only on the specified interface. However, outgoing packet routing is handled by the kernel. To make all packets produced by aMule go through a specific interface, you'll have to edit the routing rules. One way to do it is with a recent version of iptables, see the 'owner' match and the 'ROUTE' target.
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: woutermense on December 22, 2008, 11:44:51 AM
I'm breaking my head over this iptables thing and I must admit I've postponed learning about it time after time. I simply don't know how to get started. I installed an openSUSE 11.1 test box specially for this to experiment some. Does openSUSE even use iptables?
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: lfroen on December 22, 2008, 01:44:02 PM
Does openSUSE even use iptables?
Expect a whole lot of head-breaking. Google is your friend.
Title: Re: xinetd to make aMuleD use a specific network interface
Post by: phoenix on December 23, 2008, 01:59:31 AM
Does openSUSE even use iptables?
It does, but the recommended (official?) way is to go to yast2->security and users->Firewall. There you can go to Allowed Services and click on Advanced. Create a new service, e.g. ED2K, and specify the proper ports, both TCP and UDP. Then select it in the "Service to Allow" tab and click "Add". That should do the trick.

I personally do not do this, I am used to have a script to tweak the tables myself, but the reason beeing that I do that since long before there has been a nice GUI to do the job. Also, I am not so fond of GUIs :P

Cheers!