I want to know my external dynamic IP, but I just can't figure out how it works. I am a newbie in networking, but I know how to handle bash, vi and I have even spent some time learning Perl and shell-scripting.
Now, since I have inet access, I wanted to learn more about networking. I just wanted to play a little with ssh, maybe an ftp server and so on. But in order to use ssh I must know my IP adress. I got it managed two ways: Browse my router configuration (192.168.2.1 at the time), which also shows my dyn IP, or look it up at some sites probably made for nopes like me.
But there has to be a better solution. Locking at some faq's I found the following quite handy:
myip=$(ifconfig ppp0 | grep 'inet adr' | sed ... [regex to filter IP])
but it wouldn't work because in my case ifconfig output looks like this:
eth0 Link encap:Ethernet Hardware Adresse 00:0AD:0B:45:05
inet Adresse:192.168.2.32 Bcast:192.168.2.255 Maske:255.255.255.0
inet6 Adresse: fe80::20a:cdff:fe0b:4505/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:767514 errors:0 dropped:0 overruns:0 frame:0
TX packets:849144 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:326367276 (311.2 MiB) TX bytes:698669669 (666.3 MiB)
lo Link encap:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2865 errors:0 dropped:0 overruns:0 frame:0
TX packets:2865 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:4065794 (3.8 MiB) TX bytes:4065794 (3.8 MiB)
I hope you don't mind the output being german, suppose you still get it.
As you can see it just shows the local network adress (192.168.2.32). I got the tip above from an Debian faq, but I think that's not the problem.
Maybe someone could please help me?