PDA

View Full Version : Hacking Help: Connecting to oneself


ColinYounger
03-19-2008, 11:18 AM
I'm posting here as I know several lurkers are veteran hackers.

I want a script to connect (via 'socket') to the TiVo it's running on. From what I've seen and read, this should be possible.

However, I can't get my script to work on my TiVos. A simple debug script times out:set hHandle [ socket 192.168.0.200 3105 ]
close $hHandleI'm deliberately using that port as I know it works. ;)

Even a simple ping fails - .200 here is TiVo1, .210 is TiVo2. TiVo2 is trying to ping TiVo1 and then itself:TiVo2: {/var/hack} % ping -c 5 192.168.0.200
PING 192.168.0.200 (192.168.0.200): 56 data bytes
64 bytes from 192.168.0.200: icmp_seq=0 ttl=255 time=2.841 ms
64 bytes from 192.168.0.200: icmp_seq=1 ttl=255 time=5.990 ms
64 bytes from 192.168.0.200: icmp_seq=2 ttl=255 time=2.500 ms
64 bytes from 192.168.0.200: icmp_seq=3 ttl=255 time=2.522 ms
64 bytes from 192.168.0.200: icmp_seq=4 ttl=255 time=2.329 ms

--- 192.168.0.200 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.329/3.236/5.990 ms

TiVo2: {/var/hack} % ping -c 5 192.168.0.210
PING 192.168.0.210 (192.168.0.210): 56 data bytes
ping: sendto: Network is down
ping: sendto: Network is down
ping: sendto: Network is down
ping: sendto: Network is down
ping: sendto: Network is down

--- 192.168.0.210 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss

TiVo2: {/var/hack} % ping -c 5 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes

--- 127.0.0.1 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss

I suspect a setup issue in my networking, and have checked and searched until I'm ready to admit defeat. Any pointers?

FWIW, ifconfig -a shows:lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:127.255.255.255 Mask:255.0.0.0
BROADCAST LOOPBACK MTU:3584 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 coll:0

eth0 Link encap:Ethernet HWaddr 00:0B:AD:69:C6:68
inet addr:192.168.0.210 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1333 errors:0 dropped:0 overruns:0 frame:0
TX packets:276 errors:0 dropped:0 overruns:0 carrier:0 coll:0
Interrupt:29

TCM2007
03-19-2008, 03:00 PM
This is coming from the back of my memory, but I think you have to explicitly issue a command to enable the localhost using ifconfig and lo0.

ifconfig lo0 127.0.0.1 up

maybe?

Also, in general, you connect to yourself using the special IP 127.0.0.1 rather than your real IP.

Edit: reading your post properly, lo is already enabled; use 127.0.0.1 and you should be fine.

ColinYounger
03-20-2008, 05:14 AM
I had tried 127.0.0.1 already, and it times out:% set hHandle [ socket 127.0.0.1 3105 ]
<wait for a long time>
couldn't open socket: connection timed out

I can connect to the other TiVo fine, just not itself.

I notice there's no gateway listed in the ifconfig output. Is that normal?

TCM2007
03-20-2008, 01:02 PM
Have you tried issuing the "up" command from my post?

The word "UP" is missing from the description of lo in yours I now notice.

try

ifconfig lo up

ColinYounger
03-20-2008, 01:25 PM
Rock and roll. TCM - you're a genius, as we always knew. In my area you're known as a man as smart as a person with two heads. :up:

To work I go...

ColinYounger
03-21-2008, 12:12 PM
Note for lurkers - this setting needs refreshing on a reboot. rc.sysinit has a call to it commented out - uncommenting that ONE line works.