IP herausfinden

C

Cumulus II

Jungspund
Hi
ich hab im Keller einen Linux-Server ohne grafisches system stehn und jetz wollt ich fragen ob ich irgendwie über die shell die IP rauskriegen kann, mit der der Server im internet ist.:hilfe2:
Edit: Mit ifconfig hab ichs schon probiert aber da steht nur die ip aus dem lokalen netzwerk, nich die ausm internet
Dumbledore:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:66:1E:AB:DA
inet addr:192.168.1.99 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::219:66ff:fe1e:abda/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2393 errors:0 dropped:0 overruns:0 frame:0
TX packets:2158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:327149 (319.4 Kb) TX bytes:1219899 (1.1 Mb)
Interrupt:217 Base address:0xe800

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:836 errors:0 dropped:0 overruns:0 frame:0
TX packets:836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:123200 (120.3 Kb) TX bytes:123200 (120.3 Kb)

lg Cumulus II
 
Zuletzt bearbeitet:
Wenn du einen Router verwendest, dann kannst du entweder das Routerinterface mit lynx oder anderen Werkzeugen parsen, oder du nutzt ein externes Protokoll wie z.B. hier:
http://www.myip.ch/

Gruß Wolfgang
 
Das in Deine Konsole reinschreiben/kopieren.
Code:
lynx -source www.whatismyip.com | awk '/Your IP Is .*/ {print$7}'|sed -e 's/<\/h1>//'
 
whatismyip.com pumpt 2k übers Netz. Nimm checkip.dyndns.org, nur ca. 100 Byte. Hier ist mein extern_ip.sh Script:
PHP:
#!/bin/sh

curl -s checkip.dyndns.org | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1
 
Zuletzt bearbeitet:
whatismyip.com pumpt 2k übers Netz. Nimm checkip.dyndns.org, nur ca. 100 Byte. Hier ist mein extern_ip.sh Script:
PHP:
#!/bin/sh

curl -s checkip.dyndns.org | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1
wo muss denn das skript liegen, dass !/bin/sh eine wirkung zeigt?
ich habs mal ohne ausprobiert da kam aber:
Dumbledore:/ # curl .s checkip.dyndns.org | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1

curl: (6) Couldn't resolve host '.s'

curl: (6) Couldn't resolve host 'checkip.dyndns.org'
zu lynx:
wie installiert man das?
ich kenn mich da noch nich so gut mit aus

lg Cumulus II
 
Du hast einen Tippfehler drin. Es heißt "-s" und nicht ".s"!
 
danke
jetzt kommt zwar kein fehler mehr, aber sonst kommt auch nix
 
Hallo
Das geht auch mit wget und GNU grep

Code:
wget  "http://www.myip.ch/" -q -O - |grep -o "[[:digit:]].*[[:digit:]]"
 
Hallo
Das geht auch mit wget und GNU grep

Code:
wget  "http://www.myip.ch/" -q -O - |grep -o "[[:digit:]].*[[:digit:]]"
dann kommt:
Code:
Dumbledore:~ # wget "http://www.myip.ch/" -q -0 - | grep -o "[[:digit:]].*[[:digit:]]"
wget: invalid option -- 0
 
Abtippen scheint nicht Deine Stärke zu sein, oder?

Code:
wget "http://www.myip.ch/" -q -[B]O[/B] - | grep -o "[[:digit:]].*[[:digit:]]"
Das ist ein O und keine 0.

Aber wieso abtippen?

Copy&Paste ist doch viel einfacher.

Greetz,

RM
 
Hallo

Welches wget hast du denn?
Das ist übrigens ein großes O wie Oma, keine Null.

-O file
--output-document=file
The documents will not be written to the appropriate files, but all will be concatenated together and written
to file. If - is used as file, documents will be printed to standard output, disabling link conversion.
(Use ./- to print to a file literally named -.)


$ wget --version
GNU Wget 1.10.2

Gruß Wolfgang
 
Code:
Dumbledore:~ # wget --version
GNU Wget 1.10.2
mit dem O gehts aber da komm nix
Code:
Dumbledore:~ # wget "http://www.myip.ch/" -q -O - | grep -o "[[:digit:]].*[[:digit:]]"
Dumbledore:~ #
zu Copy&Paste:
das reinkopieren in cygwin geht nich
 
Hier noch ein paar weitere "zusammengeklickte Permutationen".

Code:
lynx -source checkip.dyndns.org | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}"

lynx -source http://www.myip.ch/ | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}"

lynx -source www.whatismyip.com | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1

curl -s www.whatismyip.com | awk '/Your IP Is .*/ {print$7}'|sed -e 's/<\/h1>//'

Und für ganz "Umständliche":

Code:
wget  "www.whatismyip.com" -q -O - |grep -o "[[:digit:]].*[[:digit:]]"|head -2|tail -1

Greetz,

RM
 
was ist denn jetz mit der ausgabe von der ip? da kommt ja nie was.?(
 
@Cumulus II:

Hast Du den "Lattenzaun"/"Hash"/"Shellscript Kommentarmarker" # miteingegeben?
Copy/Paste dies:

curl -s checkip.dyndns.org | grep -oEe "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1

thx to Wofgang:
www.myip.ch ist auch schön kurz.
 
Zuletzt bearbeitet:
scheint zu gehn. kommt auf jeden fall keine fehlermeldung aber ne ip kommt da auch nich
 
Probier doch einfach mal das, was ich im Post #2 gesagt hab, und sag mir dann obs geklappt hat.
 
da braucht man doch lynx für oder?
ich hab nur wie gesagt keine ahnung wie man das installiert.
:(
 

Ähnliche Themen

Problem bei der installation einer Sun Netzwerkkarte

Ethernet wird nicht erkannt

Openvpn will nicht

Debian 7.6 kein lokales Netz

Debian Routing Problem

Zurück
Oben