Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was desperately trying to set up my system as an externally accessible machine in the past 4 days without luck. Must say , it was a great journey so far, learned a lot about linux networking in details, but I have an issue with reaching my machine from the internet. I try to detail everything for better understanding.

System landscape:

  • two old ThinkPad-T60 laptop,
  • two 3G USB wifi dongle (service provider: Three.co.uk),
  • OS: Ubuntu quantal 12.10
  • no router, modem, or any other device

I try to achieve the following:

Setting up a laptop as an externally reachable web-server running apache2 , listening on port 80 as usual. The host machine connected to the internet through a 3G dongle. No other device on it's way, external router etc..

I've done the following so far

Started off with a clean Ubuntu install just to make sure. Installed apache2 and php5. Installed noip2 module.

SUMMARY

Apache2 is up and running just fine. I can load the default unformatted site from the browser referencing to localhost.

I've registered at no-ip.com basic account (dynamic DNS service) and installed it's software which keep their server up to date with my dynamic IP. Tested and double checked, its working perfect.

I am pretty sure about , I have to 'play' with the iptables so I was going through many tutorials and documentations to have better understanding. Since the machine is not reachable from the outside network still, I assuming that I do not do something quite right.

Some necessary outputs

$ifconfig

eth0      Link encap:Ethernet  HWaddr 00:1a:6b:35:c0:92  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16 Memory:ee000000-ee020000 

eth1      Link encap:Ethernet  HWaddr 58:2c:80:13:92:63  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::5a2c:80ff:fe13:9263/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:119918 errors:0 dropped:0 overruns:0 frame:0
          TX packets:103007 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:110091536 (110.0 MB)  TX bytes:13204658 (13.2 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27915 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27915 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2253626 (2.2 MB)  TX bytes:2253626 (2.2 MB)

wlan0     Link encap:Ethernet  HWaddr 00:1b:77:03:f0:97  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http state NEW,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http-alt state NEW,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8888 state NEW,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

IP TABLES CONFIG from a bash script i wrote executed as --> ./basicfw.sh eth1

#!/bin/bash

# Delete everything
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -Z

iptables -F INPUT
iptables -P INPUT ACCEPT
iptables -F OUTPUT
iptables -P OUTPUT ACCEPT
iptables -F FORWARD
iptables -P FORWARD ACCEPT

iptables -A INPUT -i $1 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i $1 -p tcp -m tcp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i $1 -p tcp -m tcp --dport 8888 -m state --state NEW,ESTABLISHED -j ACCEPT

netstat -anl | grep LISTEN

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 :::8888                 :::*                    LISTEN     

nmap ***.no-ip.org

Starting Nmap 6.01 ( http://nmap.org ) at 2012-11-13 10:57 Central Europe Standard Time
Nmap scan report for 92.41.31.247.threembb.co.uk (92.41.31.247)
Host is up (0.11s latency).
Not shown: 99 filtered ports
PORT STATE SERVICE
113/tcp closed ident
Nmap done: 1 IP address (1 host up) scanned in 3.70 seconds

As you can see the setup is pretty lame, I've just got into this whole subject. I assume that I do not have to forward eth1 to any other inerface because I think it is the one where traffic entering on the given address.

I would like to hear any mature opinion about the possible work around to establish a WAN connection with this machine.

ISP may blocking port 80 so I tried to change the setup to 8080 and forwarded from no-ip.com dns service.. opened 8080 on iptables , reconfigured apache2 properly and its still unreachable.

I do not want to use this solution to any real life use-case , just try to make it work. It's a nice learning curve.

Thanks in advance, Pete**

share|improve this question

1 Answer 1

From your output, it looks like the only interface that has an IP address is eth1 - 192.168.1.100. It's a private (rfc1918) IP address that you won't be able to reach directly from the Internet.

How does NoIP infere that your public dynamic IP address is 92.41.31.247? I haven't used the three.co.uk services so I'm not sure what this dongle does. I assume that the NoIP client connects from your machine to NoIP's website and is seen as this public IP address, but you didn't show us how you actually connect to the Internet yet :)

What does your routing table look like? Look at output of ip r and a list of all interfaces configured with an IP address with ip a.

Your iptables firewall at it's current state doesn't do anything at all since you set the default policy of all chain to 'ACCEPT'.

I can help you set it up later but first you need to sort out the connectivity.

share|improve this answer
    
Hi Martin, Thanks very much for your kind response. Fortunately the problem has been resolved. The main issue was the fact that I was behind the NAT by the ISP. Three.co.uk filtering everything coming in. The solution was to use a reverse proxy solution with a third party properly configured server such as pagekite.com ! I'll post more technical details about this solution for benefiting others. In case you haven't heard about that solution worth to check out, fascinating stuff. –  Peter G. Nov 25 '12 at 21:48
    
I'm glad you figured it out - I was thinking that this might be due to the NAT but wasn't sure. Good luck! –  Marcin Kaminski Nov 26 '12 at 15:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.