| View previous topic :: View next topic |
| Author |
Message |
dermund n00b


Joined: 28 Aug 2007 Posts: 72 Location: Sprawl
|
Posted: Wed Mar 12, 2008 2:39 pm Post subject: sending a magic packet triggered from iptables [solved] |
|
|
Hi
I want to wakeup up my music server if my Xbox360 is powered up. My router in the middle runs linux and iptables. Is it (and how) possible to capture whatever the xbox sends at startup [I guess it will send some stuff] from iptables and trigger a external program that sends a magic packet to wakeup the server?
My problem can nearly be narrowed to the iptables thing: How do I capture this xbox stuff and how do I trigger a external program with iptables rules.
T h a n k s
D e r m u n d
Last edited by dermund on Thu Mar 13, 2008 5:18 pm; edited 1 time in total |
|
| Back to top |
|
 |
Zepp Veteran


Joined: 15 Mar 2004 Posts: 1241 Location: Ontario, Canada
|
Posted: Wed Mar 12, 2008 4:02 pm Post subject: Re: sending a magic packet triggered from iptables |
|
|
| dermund wrote: | Hi
I want to wakeup up my music server if my Xbox360 is powered up. My router in the middle runs linux and iptables. Is it (and how) possible to capture whatever the xbox sends at startup [I guess it will send some stuff] from iptables and trigger a external program that sends a magic packet to wakeup the server?
My problem can nearly be narrowed to the iptables thing: How do I capture this xbox stuff and how do I trigger a external program with iptables rules.
T h a n k s
D e r m u n d |
You can probably trigger the event when the Xbox requests an ip address via DHCP. Assuming you are using dhcp.
Another suggestion would be to just listen for connection requests to Xbox live's ip/domain address. Assuming it tries to connect to xbox live immediately when it is turned on. |
|
| Back to top |
|
 |
dermund n00b


Joined: 28 Aug 2007 Posts: 72 Location: Sprawl
|
Posted: Wed Mar 12, 2008 4:27 pm Post subject: |
|
|
| Quote: | | You can probably trigger the event when the Xbox requests an ip address via DHCP. Assuming you are using dhcp. |
Yea, I thought of that too. But my real problem - that I have no guess about is how to trigger a external program trough a iptables rule. How does the rule have to look like - if it's possible with iptables at all. |
|
| Back to top |
|
 |
aronparsons Tux's lil' helper

Joined: 04 Oct 2004 Posts: 113 Location: Virginia
|
Posted: Wed Mar 12, 2008 4:37 pm Post subject: |
|
|
I don't think an iptables target exists to execute a command. However, you could use the 'LOG' target, a syslog filter to send matches for that iptables log entry to a certain file and a script that sets up an inotify watch on that log file and when a write event occurs, send the WOL packet. Maybe there's an easier way, but that would work and shouldn't be too difficult to implement.
Another option is to create a small daemon that sends one ICMP packet to your Xbox's IP every few seconds. If it replies, send a WOL packet. It would be more resource intensive (although we're talking about nothing here really). I had something like this setup to set limits on KTorrent when my XBMC would come up due to limited wireless bandwidth. |
|
| Back to top |
|
 |
cyrillic Veteran


Joined: 18 Feb 2003 Posts: 7086 Location: Groton, Massachusetts USA
|
Posted: Wed Mar 12, 2008 5:20 pm Post subject: |
|
|
| If you run dnsmasq on your router, you could easily use the "dhcp-script=" option in /etc/dnsmasq.conf to trigger an external program when your Xbox360 requests an IP address. |
|
| Back to top |
|
 |
dermund n00b


Joined: 28 Aug 2007 Posts: 72 Location: Sprawl
|
Posted: Thu Mar 13, 2008 5:17 pm Post subject: |
|
|
Yea, cool, thanks. Both nice ways. ICMP is quick and easy and I think my router could get the workload managed Thanks for the dhcp-script option however, I will try that too.
 |
|
| Back to top |
|
 |
|