Posts Tagged ‘network’
DHCPNAK
By chys on November 3rd, 2009The following is extracted from my system log file:
Nov 1 11:53:24 laptop dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Nov 1 11:53:24 laptop dhclient: DHCPNAK from 192.168.1.1
Nov 1 11:53:25 laptop dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
Nov 1 11:53:25 laptop dhclient: DHCPOFFER from 192.168.1.1
Nov 1 11:53:25 laptop dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Nov 1 11:53:25 laptop dhclient: DHCPACK from 192.168.1.1
Nov 1 11:53:25 laptop dhclient: bound to 192.168.1.3 — renewal in 39303 seconds.
Apparently, my computer tried to renew the IP address from the router, and was rejected. Then my computer started over a new DHCP request, and was offered the same IP.
I found all renewal requests were denied after checking the logs back a few days. I wonder if the router was designed to deny any DHCPREQUEST unless it immediately follows a DHCPOFFER. I can’t figure out any good reason for this. What I could think of is that the firmware programmers were just too lazy to implement a good DHCP server – after all, it was the cheapest wireless router I was able to find…
SSH as Proxy
By chys on June 8th, 2009One of my favorite sites is inaccessible from my office (computer client hereinafter), for unknown reasons. But I can connect via SSH to a computer at another place (computer server hereinafter), where I can connect to that site. So it is necessary for me to use SSH tunnel as a proxy.
Steps:
1. Make sure compute server is running the SSH daemon;
2. Create an SSH tunnel by running ssh -C2TnN -D localhost:8080 username@server on computer client;
3. Use localhost:8080 as a SOCKS 5 proxy on computer client;
4. Have fun.
I need the proxy for only one or two sites, so I use FoxyProxy to automatically switch proxies.
References
[1] How to use ssh as a proxy server
[2] Proxy Firefox through a SSH tunnel
tcpdump
By chys on October 24th, 2008I wanted to find out if remote X creates a lot of network flows, so I logged into a remote computer with “ssh -Y“, started xclock, and then typed tcpdump. Then screen began scrolling up crazily like this:
13:21:00.694367 IP xxx.xxx.xx.xx.45762 > 192.168.1.3.ssh: . ack 60640 win 2003 <nop,nop,timestamp 191668683 75287130>
13:21:00.694430 IP 192.168.1.3.ssh > xxx.xxx.xx.xx.45762: P 70416:70464(48) ack 113 win 501 <nop,nop,timestamp 191668683 75287200>
Was X sending/receiving lots of data even if it seems to be idling? It shouldn’t be so silly.. And… Finally I realized what a big mistake I had made… It was like putting a microphone against a loudspeaker…
SSH with X
By chys on October 22nd, 2008Just successfully started FCITX and typed Chinese in OpenOffice remotely..
X11 forwarding should be first enabled both at the server and client ends.
At the server end, put “X11Forwarding yes” in /etc/ssh/sshd_config, restart SSH daemon and it should be able to forward X11 requests.
At the client end, connect with “ssh -X
Host *
ForwardX11 yes
ForwardX11Trusted yes
The last line is not needed if “ssh -X” works. In some circumstances only “ssh -Y” does, then ForwardX11Trusted is necessary.
ps1. If network is slow, “-C” (compress) may help.
ps2. X must be running with “-nolisten” argument, which (I guess) is the default in most distributions.
Too Smart Router
By chys on October 17th, 2008I got a router between the WAN port and my computer. It seems it is just so “smart” that it, in the name of security, is preventing me from working properly…
If I don’t use the router, I can easily connect to my computer using SSH and the connection still is active after being idle for an hour, which should be normal when you log in remotely.
With the router, I told it to redirect incoming requests to port 22 to my desktop, which works actually. HOWEVER, the router not only kills connections that has been idle for just a few minutes, but also rejects further requests from the same IP for a long time! So I now have a bash script:
#! /bin/bash
until read -t10; do
date
done
Once I finish something in SSH, I run this script. It sends several bytes every ten seconds so that the router won’t consider the connection idle… I’m wondering what better workaround I can use (other than disconnecting frequently…)? I’m almost sure the router can’t be configured so that it allows a connection to be idle for a long time..
[Update Oct 26: A better solution may be sending null bytes periodically, like what PuTTY does. This is usually called "anti-idle".]
A similar problem happened when I was transferring files from my laptop to my desktop (both connected to LAN ports of the router) with SCP. I issued SCP commands about ten times in several minutes, and further connections were rejected too. Is it possible to be again the router’s fault? (SSH daemon had no reason to do so, I think.)

