Code Monkey home page Code Monkey logo

Comments (19)

AIT-Servidores avatar AIT-Servidores commented on June 15, 2024 1

para contribuir a lo que dijo normcyr , le dejo esto por aquí:

/sbin/ifconfig | grep "inet" | awk -F' ' '{print $2}' |sed -n 1p | cut -f2 -d ':'

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Hey @adjagu,

It looks like you're running an old version of hostname...
Run hostname --version and tell me what it says. On my side it outputs : hostname 3.18.

The version that added the -I option (--all-ip-addresses) should be greater than yours.

I start thinking about that, expect a workaround within 12 hours [EDIT: after your response 😛] 😉

Greetings 👋

from archey4.

adjagu avatar adjagu commented on June 15, 2024

hostname --version returns hostname (GNU inetutils) 1.9.4. Compared to yours mine does seem outdated, but checking the repo for it shows that mine is at the latest version on Arch Linux.

Arch Linux - inetutils version 1.9.4-5
GNU inetutils version 1.9.4

I do not have the option for (--all-ip-addresses) with my hostname. The options I do have are as follows:

-a, --aliases = alias names
-d, --domain = DNS domain name
-f, --fqdn, --long = DNS host name or FQDN
-F, --file=FILE = set host name or NIS domain name from FILE
-i, --ip-addresses = addresses for the host name
-s, --short = short host name
-y, --yp, --nis = NIS/YP domain name

I left out -?, --help --usage and -V, --version.

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Hey, thanks for the answer, so it looks like this package is even outdated in the AUR.
I'll try within some days to build a workaround for these older versions, but it would not be as fast as hostname -I is...

EDIT : @adjagu Do you have the ip command altough ? We can use ip addr show, but I'd like to make sure you have it beforehand...

👋

from archey4.

adjagu avatar adjagu commented on June 15, 2024

I do have ip available on the system. ip -V returns ip utility, iproute2-ss170705.

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Perfect, tomorrow or monday I'll try to make something from it 😉, I'll keep you posted 👌

from archey4.

adjagu avatar adjagu commented on June 15, 2024

Cool. I was surprised to find out that debian hostname actually has more options than GNU hostname (from GNU inetutils). One of the main reasons I moved to Arch Linux was the newer, updated packages. Thank you for your time and consideration @HorlogeSkynet.

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Re' @adjagu !

As promised, you'll find the workaround I was talking about on the new branch.
Could you clone and test it ?

When you'll be OK, I'll merge that and replace tabs by white-spaces as Python recommends it...

++

from archey4.

adjagu avatar adjagu commented on June 15, 2024

All working on my end now @HorlogeSkynet. Thank you for your fast fix 👍

screenshot_2017-08-06_16-26-38

from archey4.

adjagu avatar adjagu commented on June 15, 2024

While I was right it ran without error, the displayed ip address is not the address of my machine. The ip address to this machine (router always gives this machine the same address because it hands addresses out based upon mac address) is 192.168.1.10, but the script displays 192.168.1.255.

Edited ip addr output follows:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether ??:??:??:??:??:?? brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 ????:????:????:????:????:????:????:???/64 scope global mngtmpaddr noprefixroute dynamic 
       valid_lft 604625sec preferred_lft 604625sec
    inet6 ????::????:????:????:????/64 scope link 
       valid_lft forever preferred_lft forever
3: wlp2s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

from archey4.

normcyr avatar normcyr commented on June 15, 2024

The 192.168.1.255 address is probably the broadcast one.

@adjagu would the output of /sbin/ifconfig | grep "inet" | awk -F' ' '{print $2}' | sed -n 3p give you your local IP?

from archey4.

normcyr avatar normcyr commented on June 15, 2024

or if you do not have the net-tools package installed, would ip route show get your local IP in the output?

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Hello to both of you @adjagu @normcyr,

Sorry, my bad : While re-adapting the Popen calls, I did choose a bad field number.
Now (with c04d74d), it'll display the machine's IP address(es), not the network's broadcast one(s).

@normcyr ip route show will effectively display the IP address, but I don't think the other ones like hostname -I did in your case for instance 😉
Your trick with ifconfig is good, but the command is deprecated for now, that's why I'd rather use ip !

++

from archey4.

adjagu avatar adjagu commented on June 15, 2024

@normcyr Arch Linux depreciated ifconfig in favor of ip, and yes, ip route show does have the correct source address shown.

@HorlogeSkynet I'll pull the new one and give it a go and return with results.

I'm back from testing. LAN_IP now returns the proper address, but now WAN_IP outputs the IPv6 (inet6) address of LAN_IP. Checking with my router WAN_IP outputs the IPv6 (inet6) address of LAN_IP (this computer), but not the IPv6 address of my router. If this is the intended output then everything is good on my end. I was unsure of this as none of the 'Archey' scripts ever populated WAN_IP until today.

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Hello @adjagu,

The WAN_IP now uses dig +short myip.opendns.com @resolver1.opendns.com, or (if you don't have dig) what this page displays : https://ident.me.

Could you tell me what it outputs in your case ?

It can't be related to the LAN_IP results, and if you have an IPv6 address, it's because your FAI gives you one 😮

Moreover, your machine is not connected to the Internet, right ? So it should displays No Address 🤔

from archey4.

adjagu avatar adjagu commented on June 15, 2024

@HorlogeSkynet I do not have dig, but when I visited https://ident.me it did display this computers IPv6 address, same thing that Archey was showing for WAN_IP (I say was because when I run it now it does not populate WAN_IP at all).

Yes I am connected to the internet, via my router. I believe I was confusing WAN_IP with WiFi earlier because this computer has both wired and wireless I for some reason was thinking that WAN_IP was for my wireless connection (which is never active).

So, now that I am no longer confused here is what happens. I run Archey and it works and returns the proper IPv4 (local) and IPv6 (external) addresses for this computer. I have zero idea why WAN_IP is not populating now since ip addr show does output the IPv6 address.

2nd Edit:
Took my router back to factory settings and set it up again. Now everything is fine. I actually hadn't touched the settings for a few years (since before we had IPv6).

Now when I run Archey LAN_IP returns this computers local IPv4 address and WAN_IP returns this computers external IPv6 address.

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

I was doing the same mistake some years ago too 😆

So everything is OK I assume ? If it's the case, feel free to close this one, and I'll merge that !

from archey4.

adjagu avatar adjagu commented on June 15, 2024

Yeah, all is good. Thank you for your time and effort to fix this @HorlogeSkynet 👍

from archey4.

HorlogeSkynet avatar HorlogeSkynet commented on June 15, 2024

Perfect 👌, merged with : c04d74d (fast-forward was unfortunately disabled...)

--> No problem, you're welcome. See you for the next issue @adjagu 😉

EDIT : Well, that was not the good button 🤣

from archey4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.