View Full Version : Static IP on Touch
Hi need a hint on how to edit the Interfaces file for Touch
(figured it out for controller and Radio but not for Touch)
Any good examples on:
a. wifi with static ip
b. ethernet with static ip
c. wifi & ethernet with static ip's
These factory resets when you do it wrong is tedious.. and boring to reset everything else.
Tia
Mikael
squeezetouch
2010-04-14, 21:21
hi Mikael,
Enable on your Touch remote login....
Settings -> Advanced -> Remote Login -> Enable SSH
Use something like Putty (or similar for Windows, or command line in Linux) to access the Touch.
Edit the file 'interfaces' located in /etc/network/.
Edit/add the relevant lines to read like in the example below (this is for WiFi wlan0, but can be applied for ethernet eth0 as well):
auto wlan0=(your SSID name)
iface (your SSID name) inet static
address 192.168.1.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
script /etc/network/udhcpc_action
Hope this helps.
Ron
These factory resets when you do it wrong is tedious.. and boring to reset everything else.
You need a good reset script. When doing dangerous stuff like this remotely on normal Linux systems (a great example is tweaking the firewall on a server that's hours away from me), I like to do things like schedule an 'at' job to run 5 minutes later that restores the old config file and stop/starts networking. Then I can at least get back in pretty quickly if I goof badly.
Since Touch doesn't have 'at' or 'cron' facilities, you need to do something like make a shell script like
#!/bin/sh
sleep 300
# you should have saved a known good config to /etc/network/interfaces.orig
cat /etc/network/interfaces.orig > /etc/network/interfaces
ifdown -f wlan0
ifup wlan0
and then run that in the background. If your new config works, you can use the 'jobs' command to get the background task ID and 'kill %N' to stop it. If you new config fails, sit tight and wait for the background shell script to save you.
Can you run "cat" on your actual interfaces file on the Touch and paste here .
The devil is in the details ;)
I tried something along what I used on my controller and radio (where eth0 is wifi on SBC eth1 is wifi on radio).
Thanks for the scripts sugestion , I've never tried a script in linux before ?
It is a text file *.sh ? where to i put it ? or can i type it directly in the shell and it will run (I supose then it will run once).
On my controller I have
# cat interfaces
auto lo
iface lo inet loopback
mapping eth0
script /etc/network/if_mapping
auto eth0=Liogor
iface Liogor inet static
address 192.168.1.6
network 192.168.1.0
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
dns 192.168.1.1
up echo 'nameserver 192.168.1.1' > /etc/resolv.conf
#
My radio has
# cat interfaces
auto lo
iface lo inet loopback
mapping eth1
script /etc/network/if_mapping
auto eth1=Liogor
iface Liogor inet static
address 192.168.1.8
network 192.168.1.0
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
dns 192.168.1.1
up echo 'nameserver 192.168.1.1' > /etc/resolv.conf
#
The unmolested Touch has this:
# cat interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
script /etc/network/udhcpc_action
mapping wlan0
script /etc/network/if_mapping
auto wlan0=Liogor
iface Liogor inet dhcp
script /etc/network/udhcpc_action
#
I tried to add my stuff after auto wlan0
But it did not work I must have missed something.
Peter did I thank you for solving my 2 year old firewall mystery for me
squeezetouch
2010-04-14, 22:27
This is my interfaces file - and it seems to work.
#cat interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
script /etc/network/udhcpc_action
mapping wlan0
script /etc/network/if_mapping
auto wlan0=SSID_Name
iface SSID_Name inet static
address 192.168.0.20
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
script /etc/network/udhcpc_action
#
'static' at end of iface line.
also I did not use dns ###.###.###.### or overwrite the resolv.conf file as it gets the dns addresses from my router.
I also left the call for udhcp_action script in there. Which doesn't seem to overwrite the static IP address.
Ron
squeezetouch
2010-04-14, 22:32
Sorry forgot to mention.
Restart your network or reboot the Touch after the change in 'interfaces'.
Ron
Sorry forgot to mention.
Restart your network or reboot the Touch after the change in 'interfaces'.
Ron
restart the player should do it (it usually does) will try to boot router too.
Must have missed some tiny tiny thing
I suppose you get DNS because you left the udhcp action in there ?
I wanted to aviod that script function whatever.
My goal initially with the controller was to aviod all dchp stuff anywhere near my squeezebox system :) It have worked splendidly for over 2 years never have any weird network problems. There where doubts about the staability of the dhcp implementation in the controller, initially it had problems
Static settings everywhere makes wonders for stability (and using a router with tomato software or dd-wrt)
In principle I want static for fixed parts of my network, my mobile stuff use dhcp laptops phones etc.
I wish the devs could get working on that static-ip when dchp server is present bug :rolleyes: since 2007/2008 hmm. I really think this is basic functionality.
squeezetouch
2010-04-15, 00:16
Try replacing the IP address in your echo line with your ISP's actual DNS IP address instead your routers. (like shown here)
up echo 'nameserver 210.55.12.1' > /etc/resolv.conf
and maybe comment out the dns 192.168.1.1.
Just made these changes in my Touch and also removed the the script call line.
Rebooted and it connected without any problem. Selected Internet Radio and it's playing any station I select.
Ron
Try replacing the IP address in your echo line with your ISP's actual DNS IP address instead your routers. (like shown here)
up echo 'nameserver 210.55.12.1' > /etc/resolv.conf
and maybe comment out the dns 192.168.1.1.
Just made these changes in my Touch and also removed the the script call line.
Rebooted and it connected without any problem. Selected Internet Radio and it's playing any station I select.
Ron
made a typo of some kind, it works perfect
Here is what it is now
# cat interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
script /etc/network/udhcpc_action
mapping wlan0
script /etc/network/if_mapping
auto wlan0=Liogor
iface Liogor inet static
address 192.168.1.14
network 192.168.1.0
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
dns 192.168.1.1
up echo 'nameserver 192.168.1.1' > /etc/resolv.conf
I prefer to use my router for DNS, it works well in that respect and if my isp changes DNS servers, all my players are already ok.
Or if I change isp again.
My router has no problems with dns, i have not yet faced the dreaded log in problems with mysqueezebox.com (wich often is a dns symptom except for when the service is choked with new user ;) like every time they release a new product) Edit: I do have problems like everybody else if the server is down
Funny thing it did not take the first time i tried today ? I did :wq in vi, ok. did cat to see if really had changed pulled the plug and it restarted with the old file !?
did it again the i saved first with :w then i did :wq to be sure then i did a reboot with the reboot comand and then double checked by pulling the plug ? wot was that
And now I removed eht0 completely (for the time being) works ok too
squeezetouch
2010-04-15, 05:38
made a typo of some kind, it works perfect
Funny thing it did not take the first time i tried today ? I did :wq in vi, ok. did cat to see if really had changed pulled the plug and it restarted with the old file !?
did it again the i saved first with :w then i did :wq to be sure then i did a reboot with the reboot comand and then double checked by pulling the plug ? wot was that
In vi you can use :x to save and exit. Have never used :wq together, theoretically it should work, but am used to using :x by habit to save and exit. Always used reboot within ssh though. Haven't tried pulling the plug to restart, this may be the difference - like hardware reboot vs software reboot? - I don't know and haven't tested it.
I probably never though of using the plug option to reboot because I'm too lazy ;-) You see, my Touch is in the lounge at one end of the house and I'm in the office at the other end of the house. Too far to walk for a hardware reboot every time I've made a change. Typing reboot and hitting enter is much easier :-)
Ron
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.