kapitany
asked on
internet ip address with adsl
Hi,
Is there a way to get my current ip address with a command in linux?
I can use ip lookup web pages, but it's not 100% working. So I would like to find something within my box...
I also could use the command ifconfig but it gives me the static IP address assigned to this machine in the internal network and not the internet IP address.
Any trick?
BR,
kapi
Is there a way to get my current ip address with a command in linux?
I can use ip lookup web pages, but it's not 100% working. So I would like to find something within my box...
I also could use the command ifconfig but it gives me the static IP address assigned to this machine in the internal network and not the internet IP address.
Any trick?
BR,
kapi
ASKER
Hi,
The script works fine but the IP address is still an internal IP address. Maybe I was not giving enough details.
So I have an ADSL modem connected to the ISP's services. I have a static IP within the ISP's network. When I connect to the outside world (internet) my internal static IP is mapped to an external, so I got an external IP.
I think the only way to get this external IP to connect somewhere and asking the other what IP address he sees.. But I thought that there might be some linux commad to do this.. The ifconfig script works fine but as I told it still gives the static IP that was assign to me only for the internal trafic...
Thx,
kapi
The script works fine but the IP address is still an internal IP address. Maybe I was not giving enough details.
So I have an ADSL modem connected to the ISP's services. I have a static IP within the ISP's network. When I connect to the outside world (internet) my internal static IP is mapped to an external, so I got an external IP.
I think the only way to get this external IP to connect somewhere and asking the other what IP address he sees.. But I thought that there might be some linux commad to do this.. The ifconfig script works fine but as I told it still gives the static IP that was assign to me only for the internal trafic...
Thx,
kapi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that the only way you'll get the "outside IP" of your ADSL box is to connect to some Internet host that can look at the source IP of your connection or possibly by getting into the ADSL box and asking it what the "outside IP" is. What ADSL box do you have?
kapitany, listen there is a command that will give you ALL the connections that your box has "netstat" do a man on the netstat command "$ man netstat", so you can see what ip's your are connected to. expect a large volume of output, i recomend you pipe it to "more" ex: "$ netstat -a | more"
there you will see the information I believe you are looking for
there you will see the information I believe you are looking for
kapitany,
These questions are still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20095187
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20158327
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20156151
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20137619
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20127621
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20115335
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20079274
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11906858
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11500498
https://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20126885
https://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20117560
https://www.experts-exchange.com/jsp/qShow.jsp?ta=linuxnet&qid=20097295
EXPERTS: Please leave your thoughts on this question here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
These questions are still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20095187
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20158327
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20156151
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20137619
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20127621
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20115335
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20079274
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11906858
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11500498
https://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20126885
https://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20117560
https://www.experts-exchange.com/jsp/qShow.jsp?ta=linuxnet&qid=20097295
EXPERTS: Please leave your thoughts on this question here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Force/accepted by
Netminder
Community Support Moderator
Experts Exchange
Netminder
Community Support Moderator
Experts Exchange
----------------------
#!/bin/sh
external_interface="ppp0"
ext_ip="`/sbin/ifconfig $external_interface | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
ext_netmask="`/sbin/ifconf
echo $ext_ip
echo $ext_netmask