Wednesday, 21 January 2009

Trying to get the Wii to connect to my named virtualhost

I spent this morning trying to make it so I can access my local website from the Wii. I read this thread: Hack to browse the internet with the Wii, which is actually about re-directing the Wii shop channel website, but is basically the same as what I want to do - redirect a website address to a different ip address.

I followed the guide to setting up your PC to change the IP address the Wii shop channel points to, but the Wii said it couldn't connect to the internet. So I added the router's ip address as the secondary DNS server, and the internet worked, but it seemed the Wii was just using the router - when I typed in my local site's name, it just went to the real website, not the local one.

In the same thread, it was also suggested that you could add the site on the modem and direct it to your local ip there. I looked at all the different settings on the modem/router, and couldn't see anywhere to do this other than a section that blocks domains (but doesn't allow directing what ip address to send them to).

I tried telnetting onto the modem/router from the teriminal in Ubuntu like suggested, but the connection was refused. So I did some more googling, and found that you can go to http://192.168.0.1/setup.cgi?todo=debug on my modem/router to enable telnet. This isn't the original page where I found the info, but is quite a good overview of different stuff you can do on the netgear modems: Mel's Notes - Netgear DG834G. The other important command to note on there is killall utelnetd, which you type in the terminal when you've finished telnetting, to disable telnet again.

One I was into the modem, I spent ages and muchos googling trying to find out how to edit the hosts file, it seemed like there wasn't a text editor installed on it so you couldn't actually edit the files. Eventually I found out that you need to use cat. I had looked at cat earlier, but dismissed it as the page I read when I googled for 'Linux cat command' said it takes 2 files, concatenates their contents, then prints the result to screen.

Actually, you can view and edit files using the cat command. I found a nice PDF that explains how to use it (amongst other text editing methods in Linux): Simple Ways to edit files on SVU Hosts.
To view the contents of a file you just do cat filename
To add the new host to the file you just do cat >> filename Then enter your new host you want to add like 192.168.0.9 mysite.com
Then press Ctrl+D to save. I added a linebreak/return after adding the new line, so if I want to add any more lines, then I don't have to start off by adding a line break, because it's already there.

Before I made any changes to the hosts file, I backed it up as well cp /etc/hosts /etc/hosts_backup

But after doing all that, it didn't work! When I went on mysite.com (or any of the sites already listed in the hosts file) it just went to the website rather than the local ip address set in the hosts file. I think that probably it has been like this for quite a while, maybe always. However I'm not sure, as I always access the router through the ip address rather than a name, so it could be possible that I somehow stopped it from referencing the hosts file while I was trying to figure out how to view/edit it.

I checked the file permssions on the files (ls -l), Linux Files and File Permission gives a good overview of what the different letters and number mean. But the permissions were set the same for hosts as for hosts_backup and most of the other files, so it looked okay to me.

So I posted a question to the netgear forum to see if anyone can help me there.

The other thing to note, is that one of the commands available when telnetted into the modem is mount. I'm not sure how you would mount a drive, since the modem doesn't have a usb port (I think) or any way of attaching a drive directly to it. However, when you go to 'attached devices' in the router setup (In a web browser, not through telnet), it lists the PCs that are attached to it. So maybe you could mount your PC's filesystem? If you could, then you could type up your hosts file on your PC, then telnet into the modem, mount your PC's filesytem, then copy the hosts file from your PC to the modem. I haven't tried.

After lunch I checked my email and ebay. The guy who sold a Canon 500mm/4 IS for £2400 and then relisted it and sold it at a buy it now of £2200 it seems did actually sell 2 lenses, as he has got positive feedback from the different buyers for both transactions. Great deal for those guys that won the auctions.

I went on Animal for about half an hour, I normally go on it for about an hour each day, but Nook's was closed for remodeling. Also, when I was rolling a snowball over a bridge, it rolled down the other side into a tree and smashed :(

Then I did some more work trying to get a menu reflection. I tried copying the menu into a foreign object in an SVG, then applying a matrix transform to the foreign object to flip it upside down. It worked in Firefox, Safari and Chrome, but in Opera the page background turned white, the menu items in the SVG all went onto new lines, like they had magically been turned into block elements, and they would also disappear and Opera would crash.

I did some googling about this and read that Opera may crash when an SVG contains a foreign object, but this has been fixed in version 10 Alpha 1. So I downloaded that, but it still crashed.

I decided to press on and see if I could make it work in FF/Webkit. I tried applying a fill to the foreign object, but this didn't work. I tried creating an svg (in Illustrator) with a mask, but the mask wasn't recognised in Webkit. I tried creating and svg with 2 blocks blended in Illustrator, and when I looked at the code it was just loads of rectangles with slightly different colours and placed slightly higher/lower than the last one, which creates an impression of a blend.

After that I found that the webkit browsers make the upside down text much larger/smaller when changing text size than Firefox. I think that probably they resize the svg and also resize the html text inside the svg, so it effectively gets resized twice. I tried giving the text inside the svg a font-size specified in px, but it still resized the same.

In the evening I watched Hellboy 2 with Mac, which was good.

The weather today was sunny most of the day (though quite cold) and then overcast around sunset, then rainy in the evening.

Food
Breakfast: Maple & Pecan crunch cereal with added cornflakes and rice crispies; cup o' tea.
Lunch: ½ beetroot slices in vinegar sandwich; ½ Mature cheddar cheese with crunchy salad sandwich; packet of Flame Grilled Steak McCoy's ridged crisps; white grapes; cup o' tea.
Dinner: Beef burger with mature cheddar cheese, tomato ketchup and crispy salad in bun; bowl of vegetable fake cup a soup; ½ bun. Pudding was rice pudding with blackcurrant jam. Coffee; Oreo.

No comments: