Gentoo Forums
Gentoo Forums
Quick Search: in
sending a magic packet triggered from iptables [solved]
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dermund
n00b
n00b


Joined: 28 Aug 2007
Posts: 72
Location: Sprawl

PostPosted: Wed Mar 12, 2008 2:39 pm    Post subject: sending a magic packet triggered from iptables [solved] Reply with quote

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
View user's profile Send private message
Zepp
Veteran
Veteran


Joined: 15 Mar 2004
Posts: 1241
Location: Ontario, Canada

PostPosted: Wed Mar 12, 2008 4:02 pm    Post subject: Re: sending a magic packet triggered from iptables Reply with quote

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
View user's profile Send private message
dermund
n00b
n00b


Joined: 28 Aug 2007
Posts: 72
Location: Sprawl

PostPosted: Wed Mar 12, 2008 4:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
aronparsons
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2004
Posts: 113
Location: Virginia

PostPosted: Wed Mar 12, 2008 4:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
cyrillic
Veteran
Veteran


Joined: 18 Feb 2003
Posts: 7086
Location: Groton, Massachusetts USA

PostPosted: Wed Mar 12, 2008 5:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
dermund
n00b
n00b


Joined: 28 Aug 2007
Posts: 72
Location: Sprawl

PostPosted: Thu Mar 13, 2008 5:17 pm    Post subject: Reply with quote

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.

:D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum