grueberj
Posts: 5
Joined: Sat Dec 16, 2017 1:34 pm

ifconfig automation script

Sat Dec 16, 2017 1:52 pm

I am interested in obtaining help regarding writing a script or method that can automatically change an eth0 IP address on a RPi. The caveat to this being that the IP address that needs to be assigned, or used by the RPi is not known ahead of time and DHCP is not available.

What I'm interested in doing would be similar to DHCP functionality but on a static /24 network where there is no DHCP and any unassigned IP addresses are unknown.

I'd like to be able to plug an RPi into a network, power it up, and use tshark or some other method to be able to listen, obtain a broadcast address and from that statically assign an unused IP address to the RPi.

Has anyone encountered anything close to this? Scripting a static IP address to an interface is not difficult, provided you know the network you will be using. However, the project I'm working on will require the RPi to be plugged into many different networks and I would really like to not have to enlist remote-hands personnel to try to reconfigure the IP address every time.

epoch1970
Posts: 1746
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: ifconfig automation script

Sun Dec 17, 2017 2:02 pm

grueberj wrote:
Sat Dec 16, 2017 1:52 pm
The caveat to this being that the IP address that needs to be assigned, or used by the RPi is not known ahead of time and DHCP is not available.
Nowadays, if no DHCP service is offered on a network, it means you are not invited by the network admin.
Actively scanning can cause network load and disruption, this action will be seen as hostile in some networks. You can scan all you want, you won't be able to guarantee 100% connectivity. And you might get into trouble.

You might want to look at zeroconf implementations and see how that could help your users relate with your machine locally. Zeroconf works out-of-the-box on Raspbian, thanks to Avahi.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

grueberj
Posts: 5
Joined: Sat Dec 16, 2017 1:34 pm

Re: ifconfig automation script

Sun Dec 17, 2017 3:04 pm

I wondered when the "nefarious" reasons for my request would come into play. I actually mentioned that to my wife yesterday.

However, I am the admin and can assign an IP as I like. My wish is to prevent remote-hand interaction where and when not needed. I meant to keep my post somewhat vague in regards to the security of the project I am working on and am working for.

Scanning is another topic, meant for another thread. Scanning can and is most detrimental to specific environments. I appreciate your concern.

My request is about automation. How you can know that is uncertain. One other caveat is that switch ports on the environment in question are all disabled, so activation requires my direct intervention regardless. Again, I am posting regarding an automation process, not ethics.

n67
Posts: 697
Joined: Mon Oct 30, 2017 4:55 pm

Re: ifconfig automation script

Sun Dec 17, 2017 3:07 pm

This forum would do much better if participants left their morality at the door and concentrated on the technical issues only.

Every time I see a posting that implies something evil is going on, a comeuppance follows.


strikethrough is deserved [moderator]
"L'enfer, c'est les autres"

grueberj
Posts: 5
Joined: Sat Dec 16, 2017 1:34 pm

Re: ifconfig automation script

Sun Dec 17, 2017 3:13 pm

Sorry and thank you for the recommendation to use zeroconf. I had not thought of that and will see what that can do for me. I do understand that what I am asking could do for some really bad people with really cheap hardware at their disposal.

On another note, I could be on to the next great thing regarding IPv4 merging with IPv6 auto-discover.

epoch1970
Posts: 1746
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: ifconfig automation script

Sun Dec 17, 2017 4:15 pm

n67 wrote:
Sun Dec 17, 2017 3:07 pm
This forum would do much better if participants left their morality at the door and concentrated on the technical issues only.

Every time I see a posting that implies something evil is going on, a comeuppance follows.
It's not a matter of morality. It's a matter of responsibility. I don't judge, I inform.
Additionally, scan a network, stumble on the honeypot setup there and mount your network according to what it tells you. That will work great, for sure.

So yeah, scan away.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

grueberj
Posts: 5
Joined: Sat Dec 16, 2017 1:34 pm

Re: ifconfig automation script

Sun Dec 17, 2017 4:35 pm

Please decist troll. I am looking for technical guidance. Plugging into a honeypot/net is not what I am looking for. Your posts are entirely off-topic and not technical.

epoch1970
Posts: 1746
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: ifconfig automation script

Sun Dec 17, 2017 4:47 pm

grueberj wrote:
Sun Dec 17, 2017 3:04 pm
Scanning is another topic, meant for another thread.
No it is not. If you want to discover a network setup with 0 prior knowledge, the only option is to start by scanning it.

PS: Your PM was not well received. So long, friend.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

grueberj
Posts: 5
Joined: Sat Dec 16, 2017 1:34 pm

Re: ifconfig automation script

Sun Dec 17, 2017 5:01 pm

Why are you threatened by this post? I am asking for legitimate guidance on a technical issue. You threaten to lock this post down. You are quite defensive about being a troll, however exhibit the patterned behavior of one.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 10643
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: ifconfig automation script

Sun Dec 17, 2017 5:58 pm

deleted troll like posting by n67.
next step will be an immediate permanent-ban.

n67
Posts: 697
Joined: Mon Oct 30, 2017 4:55 pm

Re: ifconfig automation script

Sun Dec 17, 2017 5:59 pm

I have sent you a PM which should clear up any misunderstandings we may have had in this thread.
"L'enfer, c'est les autres"

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 15 guests