ish
ish copied to clipboard
ip/ifconfig not working, needs netlink
Hello, I have tested ~20 packages today and I found some interesting things about ip and ifconfig on iSH :
ip route get 1
give me ip: socket(AF_NETLINK,3,0): Invalid argument
ifconfig
give me
iPad~# ifconfig
ifconfig: /proc/net/dev: No such file or directory
ifconfig: ioctl 0x8912 failed: Invalid argument
I found no issue related to this
There's no need for these to work, as network connectivity is managed by iOS. Still, I should make them return better errors.
We can't get local IP on iOS without going to settings ? It would be useful
That would be pretty useful actually.
Output from ifconfig would still be handy. :)
Regarding this, when using iSH with F5, it doesn’t know of routes coming in via the VPN, and as such I’m unable to ssh to machines in the VPN network.
If ish does not have IP, then SSH cannot be used?
SSH and internet works fine. The only thing that doesn't work is the ip
and ifconfig
commands.
SSH and internet works fine. The only thing that doesn't work is the
ip
andifconfig
commands.
The difference is that if the mobile phone can access the alpine system through network, we could have the inside system to do many things, like establishing an ssh tunnel and using the tunnel to proxy the mobile phone network. Just like a accessable local backend.
ssh tunneling should work fine.
is there any way that other apps could access the tunnel ?
What are you trying? What does it do instead of working?
Sorry, the network works fine. I can access the localhost port. Another issue is the tunnel need background data refresh.
Any progress on this?
Bump
Ifconfig is obsolete for iSH, it would be iplink && ip a to display network devices. 'AF_NETLINK missing socket' displayed due to config repository not added. Make sure you have drivers installed Run 'apk add linux-firmware' for drivers add config repo.. and setup lo loop back in networking.
Hi @Tmero2, would you be able to clarify your comment? I have run apk add linux-firmware
but I'm still getting the error ip: socket(AF_NETLINK,3,0): Invalid argument
.
I am trying to understand:
- "add config repo" - is there any documentation on this config repo and how to add it?
- "setup lo loopback" - does this happen automatically when installing linux-firmware, or is it a separate step? If it is another manual step is this the same as adding a loopback device on standard linux, or are there any additional steps for iSH?
Thanks
Hi @Tmero2, would you be able to clarify your comment? I have run
apk add linux-firmware
but I'm still getting the errorip: socket(AF_NETLINK,3,0): Invalid argument
.I am trying to understand:
- "add config repo" - is there any documentation on this config repo and how to add it?
- "setup lo loopback" - does this happen automatically when installing linux-firmware, or is it a separate step? If it is another manual step is this the same as adding a loopback device on standard linux, or are there any additional steps for iSH?
Thanks
It appears that @Tmero2 has been inactive on Github since he first signed up, back in May of last year. That comment above is only 1 of 2 tangible footprints he'd left on this network thus far.
So it's back to a bit more of the good ole google-fu exercise routine.
Unless of course the man himself @tbodt -->>> the original Dev, would kindly care to chime in.
Cheers, fellas!
This script create by Abo5 using python
To get your ip in ish app do this steps
Usage:
cat > get-my-ip.py
import socket
#creating a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#sending a dummy packet to a public DNS server
s.connect(("8.8.8.8", 80))
#getting the local IP address
ip = s.getsockname()[0]
#printing the IP address
print("Your IP address is:", ip)
#closing the socket connection
s.close()
and run the script
python3 get-my-ip.py
output is
Your IP address is: 192.168.1.100
Here is a C version by ChatGPT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
int get_local_ip(const char* target_ip) {
int sockfd;
struct sockaddr_in servaddr;
char buffer[1024];
// Create socket
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd == -1) {
perror("Error creating socket");
return -1;
}
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(80);
servaddr.sin_addr.s_addr = inet_addr(target_ip);
// Connect to server
if (connect(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr)) == -1) {
perror("Error connecting");
close(sockfd);
return -1;
}
// Get local IP address
struct sockaddr_in localaddr;
socklen_t addrlen = sizeof(localaddr);
getsockname(sockfd, (struct sockaddr*)&localaddr, &addrlen);
char* ip = inet_ntoa(localaddr.sin_addr);
printf("Your IP address is: %s\n", ip);
close(sockfd);
return 0;
}
int main(int argc, char* argv[]) {
if (argc != 2) {
printf("Usage: %s <target_ip>\n", argv[0]);
return 1;
}
if (get_local_ip(argv[1]) == -1) {
printf("Unable to retrieve IP address for %s.\n", argv[1]);
return 1;
}
return 0;
}
you can compile it using gcc
gcc -o ip_checker ip_checker.c
Then run it:
iSH:~# ./ip_checker 8.8.8.8
Your IP address is: 192.168.123.101
But you don't actually need to enter an ip address, any number also work!
iSH:~# ./ip_checker 1
Your IP address is: 192.168.123.101
Here's my pre-compiled binary. ip_checker.zip