Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

netstat foreign address code help? 1

Status
Not open for further replies.

rigstars2

Instructor
Dec 18, 2011
64
US
I'm trying to massage code so that if it finds any ip address(except 0.0.0.0) in the foreign address column it will print out "foreign address found"
right now, it is printing "foreign address found" due to $5 being a column ..
the default ip in column $5 is 0.0.0.0:*

if there is an easier approach to this, I'm all ears ..

netstat -lntup |grep -i 'listen' | awk '$5{print "foreign address found"}'
foreign address found
foreign address found
foreign address found
foreign address found
foreign address found

Thanks!
 
0.0.0.0 does not imply an internal IP address (Not routable on the internet) The actual list follows

10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255

Any IP address within the above ranges are internal to your network. You will probably also have a number of IP address reserved for your specific network so that external users can connect to you. ask your network people what they are or use a whois query for your domain.



Bill
Lead Application Developer
New York State, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top