The iphone and ipod touch are capable Unix servers. You can run web services, terminal services,
and file sharing, and connect to these servers from any computer. But unfortunately, most cellular
providers have pierce firewalls that prevent your phone from permitting connections to any of these
services via eDGe or 3G.
There are various reasons, besides the novelty of serving your web page from your pocket, why
you’d want to allow external connections. if you’ve gotten tech support for your iphone hacking
and your assistant needs to ssh into your phone, you’ll need to provide a way for them
to get through the firewall to do so.
The AT&T mobile network, and probably other mobile networks, have firewalls that severely d
restrict incoming connections to your phone. Therefore, you won’t be able to serve web pages
when you aren’t on a Wi-Fi network.
ip addresses
public ip addresses are ip addresses like 128.97.128.1 or 206.13.29.12. You can connect to them
from any device connected to the internet; they’re unique on the internet, and aren’t hidden deep in
a private network. private ip addresses are reserved groups of addresses like 192.168.x.x or 10.0.x.x
addresses reserved for inside a company or home that aren’t unique.
static ip addresses are private or public ip addresses that are assigned to a specific machine and
don’t change.
Dynamic ip addresses are private or public ip addresses handed to the computer
when it boots up. Dhcp stands for Dynamic host (computer) coniguration protocol, and when you
select “Dhcp,” it means, “get a dynamic ip address from a router on the network.”
The most common configuration for home internet is to have a device called a router (a.k.a. naT,
firewall; that is connected to a cable modem or DsL modem. The
router gets a dynamic, public ip address, and provides dynamic, private ip addresses to machines
inside the network behind the router.
In order for someone to connect to your iphone from the internet, the iphone needs a public ip
address. Because you can’t connect the iphone directly to a cable modem or DsL connection, you’ll
have to do the next best thing: port forwarding from your network router to your iphone.
port Forwarding
The trick of port forwarding is simple: you set a static internal ip address for your phone, and then
forward the ports of whatever services you want your iphone to serve.
To set a static internal ip address, ind out the ip addresses that your router gives out (serves
via Dhcp). Then choose one in the same subnet but outside the range of addresses that the
router will use. For instance, if your Linksys router starts at 192.168.22.100, you could choose
192.168.22.99 for your iphone.
Set the router address to the ip address of your router: usually this is the same as your device’s ip but with a .1 at the end instead of .99
or whatever you used.
Now you need to choose which protocols you want to support. For example, the hTTp protocol
(the protocol used for serving web pages) uses port 80. if you’re running a web server on your
iphone, then you can forward to any port not just 80 to the ip of your iphone. if
you need to let someone ssh into your phone, simply forward any port you choose to port 22 on
your phone. The same rule applies for services that you want to enable and forward to your phone.
If you want to open up all of the services on your iphone (on a temporary basis with no firewall)
you can put your iphone into the “demilitarized zone” or DMZ, a place where there is no firewall
protection between the internet and your device. entering your iphone’s ip address
as the DMZ server will direct any incoming traffic to your iphone. some malicious users routinely
run port scanners, which look for open services on random ip addresses. This hack opens any
network service you have running on your iphone to the network at large, and makes it a cracking
target, so do this with caution.
dynamic dnS
There’s one more trick that makes things even easier. Because most home ip addresses are
dynamic, they change frequently and can’t be counted upon, making it dificult to get back to that
website you’re trying to serve from your iphone. in this case, you need a dynamic Dns service
such as that provided by DynDns (dyndns.org) to point a domain name at your ever-changing
cable modem ip address.
Dynamic ip addresses can be used with your own domain name, but the usual quick and effective
way is to sign up for a free dyndns.org account and then enable the
dynamic Dns feature in the router. Whenever the ip address changes, your router
will inform dyndns.org, and the name that you’ve mapped to your router will keep sending traffic
your way.
Once it’s set up, you can test, or ping, your new domain name. Don’t be too worried
if the ping doesn’t work: some isps and routers have network ilters that disable pings. Just try
another service that you know is running, like ssh.
dps17-2:~ dstolarz$ ping iphonehacks.pozone.org
PING iphonehacks.pozone.org (24.24.166.171): 56 data bytes
64 bytes from 24.24.166.171: icmp_seq=0 ttl=64 time=0.944 ms
64 bytes from 24.24.166.171: icmp_seq=1 ttl=64 time=1.122 ms
if you have a set of fixed, external ip addresses, there’s no reason that your iphone can’t be directly
on the internet. all you need to do is connect a wireless router that acts as a bridge, instead of
putting the iphone behind a private set of ip addresses. if your router doesn’t have this feature, an
easy way to do it is to connect the Ethernet with all the ip addresses to the Lan port of your router
instead of the Wan port.
Then assign one of your ixed ip addresses in the iphone network settings
when you connect to the router. as long as your phone is on, you should be able to use that fixed ip
directly, and you can even assign a domain name to it. |