element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum dynamic DNS for 3G USB modem raspberry pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 16 replies
  • Subscribers 676 subscribers
  • Views 2511 views
  • Users 0 members are here
  • dns
  • raspberry_pi
  • raspberrypi
  • 3g
  • usbmodem
Related

dynamic DNS for 3G USB modem raspberry pi

bhuvan
bhuvan over 11 years ago

Hi guys

 

I have a 3G USB modem (ZTE Mf 70) . i want to access a IP camera on a particular port from the pi from anywhere in the world.

I wanted the pi to use the same Ip address everytime on bootup. I thought of using a hostname which would map to the IP address everytime (even if Ip address changes)

 

 

I wanted to know if installing a dynamic dns application on the pi, would help to achieve this.

 

or else, is there any other way of doing this ??

  • Sign in to reply
  • Cancel
Parents
  • rew
    0 rew over 11 years ago

    Your provider (in this case the 3G one) will assign you an IP address. When your location is static, say on a cable or ADSL connection, they may decide to give you the same IP address every time your computer/modem starts up. But they could also decide: we need less IP addresses because half the people have their modem turned off. So then they have to cycle through the IP addresses to serivice those that are online.

     

    Anyway, with 3G, you are likely to get a new/changing IP address every time your connection starts up. Or maybe even when you switch towers (but I doubt that:  they should make arrangements to fix that if it happens).

     

    Anyway, if you install something like "dyndns", you will be able to refer to the 'pi as <something>.dyndns.org, which will resolve to whatever IP address you got this time.

     

    However, I've also seen 3G providers that use "internal" IP addresses on their network. In that case instead of assigning an externally visible IP address to every "phone", they use an "internal only" IP address range, that only works within their own network. And when packets from your 'pi go out on the internet they are quickly translated to some public IP address. Return traffic is similarly modified to go back to your phone. This way they can save enormously on the number of public IP addresses that they need. But it means you cannot reach the internal IP addresses at all from the outside. (which is usually a bonus, because it prevents remote network attacks!).

     

    So, if you do a quick "ifconfig" and show us the results we can look up if your 3G modem gets a public IP address.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bhuvan
    0 bhuvan over 11 years ago in reply to rew

    Thank you for your reply .

    rew

    When I do ifconfig on the pi, the Ip address I get is something like 192.168.0.100, which is an internal address I guess. Will dydns still work ?

    What I am trying to do is use motion camera software on the pi to broadcast a video stream onto a certain IP address and port number.

     

    I want to be able to use the same Ip address every-time (reboot, new connection, etc).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to bhuvan

    Yup! That's an internal address which is not reachable from the outside.

     

    I personally own a "server" on the internet. For cases like this I will have the 'pi call out to the server which is similar to loading a website. Thus the provider will have to make that "work", otherwise nobody would be able to use the internet.

     

    Then I create a "tunnel", so that from the server I can reach the 'pi. Next some trickery with ports and stuff and I'd be able to reach the 'pi from around the globe.

     

    If you don't have your own server, I'm not sure if you'd be able to find a low-cost provider for such a service. I've searched for "free tunnel service" for a few minutes now, and the services that come up do something close to the reverse of what you want.... :-(

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 11 years ago in reply to bhuvan

    you can also have the Router (If you have Admin access to it) do the dydns for you, it knows the outside IP address and can manage the service for you in most cases (Older routers may not have this feature, check the user manual for details), then you can forward a socket to the internally attached PI.

     

    A socket is the PORT number and is a bit like a room number where the IP address is the house number  http://en.wikipedia.org/wiki/Network_socket

     

    it is a lot less complicated than it sounds.

     

    Is the PI going to be located in your home network and your wanting to access it via a mobile device connected to the internet ?, or is the PI and camera going to be located elsewhere ?

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to Robert Peter Oakes

    Peter, I thought Bhuvan has a 3G wireless modem. So his GSM provider has the "router" you're talking about....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 11 years ago in reply to rew

    he does mention the modem but also states he wants to access it from anywhere on the internet, so im not sure which part is stationary and which is moving, I also dont know bhuvan knowledge level so felt the need to ask a few more probing questions

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bhuvan
    0 bhuvan over 11 years ago in reply to Robert Peter Oakes

    rew and Robert Peter Oakes

    Thank you guys for your response.

     

    I think mr. Roger you are talking about reverse SSH ??? Can i get my camera working remotely using reverse ssh ?? If so, can you please let me know how to do so ??

     

    Mr, peter, the modem (USB 3G) will be inside a vehicle (car). i want to be able to monitor the video feed inside from any place in the world on a laptop/pc/tablet.

     

    I plan to use motion software to do so.

     

    Also, when I do ifconfig on pi, I get a local address like 192.168.0.100, nut when I open my browser and open whatsmyip, the IP is some public IP 74.xx.xx.xx. There is NAT clearly happening here.

     

    By using reverse ssh, can i view the video in the vehicle (connected to a 3G USB dongle) from anywhere in the world ??

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to bhuvan

    [Apparently I didn't hit "send" yesterday]

     

    Your provider (in this case the 3G one) will assign you an IP address. When your location is static, say on a cable or ADSL connection, they may decide to give you the same IP address every time your computer/modem starts up. But they could also decide: we need less IP addresses because half the people have their modem turned off. So then they have to cycle through the IP addresses to serivice those that are online.

     

    Anyway, with 3G, you are likely to get a new/changing IP address every time your connection starts up. Or maybe even when you switch towers (but I doubt that:  they should make arrangements to fix that if it happens).

     

    Anyway, if you install something like "dyndns", you will be able to refer to the 'pi as <something>.dyndns.org, which will resolve to whatever IP address you got this time.

     

    However, 3G providers mostly use "internal" IP addresses on their network. In that case instead of assigning an externally visible IP address to every "phone", they use an "internal only" IP address range, that only works within their own network. And when packets from your 'pi go out on the internet they are quickly translated to some public IP address. Return traffic is similarly modified to go back to your phone. This way they can save enormously on the number of public IP addresses that they need. But it means you cannot reach the internal IP addresses at all from the outside. (which is usually a bonus, because it prevents outside hackers from trying to hack your phone).

     

    Anyway, what you need is a VPN, then you can reach the 'pi from the VPN. And the next step would be to make that accessable for /you/ from "anywhere you want". But as I said: I'm not aware of public services that would let you do that.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bhuvan
    0 bhuvan over 11 years ago in reply to rew

    rewRobert Peter Oakes

     

    But as you mentioned before, will reverse ssh work??

     

    as I have a server which I think I can create a tunnel to.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to bhuvan

    I don't know what you mean with "reverse ssh".

     

    Hmm. SSH has "port forwarding". Yeah, that would work. From the 'pi do:

     

    • ssh server -R server:8080:localhost:80 command.

     

    This will redirect port 8080 on the server to port 80 (the web server) on the 'pi. Everybody will now be able to connect to the 'pi, so be careful. Maybe you want some kind of access control.

     

    That should work. I'm not immediately sure what command to specify (sleep 100000000 should work for a while), or if there is an option to do without a command.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bhuvan
    0 bhuvan over 11 years ago in reply to rew

    rew

    I meant this, http://www.tunnelsup.com/raspberry-pi-phoning-home-using-a-reverse-remote-ssh-tunnel

     

    I am using the motion camera software on port number 3456 on the pi.

     

    Will the camera be accessible with the above method/ tunelling method that you mentioned ??

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to bhuvan

    Yup! That would work. It is the same as what I was suggesting. That guy looked longer at the manual to figure out you need to specify "-N" to indicate to SSH that it doesn't need to do anything but open the port.

     

    You specify "3456" instead of 22....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • rew
    0 rew over 11 years ago in reply to bhuvan

    Yup! That would work. It is the same as what I was suggesting. That guy looked longer at the manual to figure out you need to specify "-N" to indicate to SSH that it doesn't need to do anything but open the port.

     

    You specify "3456" instead of 22....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 11 years ago in reply to rew

    I'm trying to do exactly the same thing on my Raspberry Pi.  I would like to be able to use two ports though, one for video, and one for serial data to communicate with a connected UART device.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 11 years ago in reply to Former Member

    Two options: run two ssh tunnels to two ports (but this assumes you have a way of connecting a port to the uart). Or just open up the "ssh" port of your 'pi using the tunnel so that you can ssh back into the pi to for the uart stuff.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bhuvan
    0 bhuvan over 9 years ago in reply to rew

    Hi Mr. Roger

     

      I tried the following steps below to view the video stream remotely , but not able to. Please help me.

     

    Note: I have rented a server with static IP on aws and referring to the same below.

    I have a USB camera connected and motion software running and wvdial running (3g dongle).

    From the PI's terminal, typed the following :

    ifconfig    ppp0      Link encap:Point-to-Point Protocol inet addr:100.106.202.59  P-t-P:10.64.64.64  Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1 RX packets:212 errors:0 dropped:0 overruns:0 frame:0 TX packets:224 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:9585 (9.3 KiB)  TX bytes:11292 (11.0 KiB) 

    Then typed in:

    sudo autossh -M 65500 -o ServerAliveInterval=20 -L 16090:100.106.202.59:8081 -R 2222:localhost:22 user@server 

    The pi was now logged into my server.

    Next, from the server (logged in via putty) I typed in:

    ssh -p 2222 pi@127.0.0.1 

    And I was able to login to the pi.

    Now, I opened up a browser on my windows laptop connected to the internet (different network) and typed in

    myserveripaddress:16090 

    And nothing showed up in the browser.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube