View Full Version : [ubuntu] Localhost is extremely slow

November 14th, 2009, 07:19 PM
This is the first time in 10 months of using Ubuntu that I haven't been able to find the solution to a problem already posted on this forum.

Anyways, my problem is that when I share my internet connection the localhost is really slow. My laptop, (running Jaunty) connects to the internet using a WiMAX USB dongle and I am sharing the internet connection with another laptop (running XP) via a crossover cable.

The problem is that when I run WEBrick to test a Ruby on Rails application it now takes up to a minute for pages to load. This problem only exists if I am sharing the internet connection.

I have to run the following script every time I restart to enable the sharing.

sudo ifconfig eth0
sudo iptables -A FORWARD -i ppp0 -o eth0 -s -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE

Any help would be greatly appreciated.

November 19th, 2009, 02:11 AM
Try putting this at the top of the script:

sudo iptables -I INPUT 1 -i lo -j ACCEPT

Also, make sure that localhost and your host name are listed in /etc/hosts.