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**