PDA

View Full Version : Setting up a static IP address



Mikey
2020-01-31, 11:18
Hi
I bought a new Raspberry Pi 3 the other day and installed Kali Linux without any problems and can connect to it via 'Putty' using the ip address thats in the wlan1 (I'm using an 'Alfa' card). I'd like to setup a static IP address as I want to take the Pi with me when I'm out and about in my local city.

I watch several videos on Youtube but after following them I'm still not able to connect using the static ip address that I assigned to the pi but I can still connect using 'Putty' with the old Ip address. I've checked the settings a few times and they are correct, but I still can't connect with the stic IP address.

I'd be grateful if someone would tell me what I'm doing wrong here.

Thanks a lot

rollercoaster
2020-01-31, 22:38
1. Determine your interface, eg eth0
2. Modify /etc/network/interface such as:

allow-hotplug eth0
iface eth0 inet static
address 192.168.0.1/24

then reboot.

Mister_X
2020-02-02, 00:36
You'll probably need to set-up an AP if you want to connect wirelessly to the RPi. Use hostapd for that. Otherwise, if you're connecting to an AP, skip this.

Here is the docs explaining how to set-up an IP: https://wiki.debian.org/NetworkConfiguration

Mikey
2020-02-02, 09:48
You'll probably need to set-up an AP if you want to connect wirelessly to the RPi. Use hostapd for that. Otherwise, if you're connecting to an AP, skip this.

Here is the docs explaining how to set-up an IP: https://wiki.debian.org/NetworkConfiguration

Hello Mister_X

Thanks for the reply.

I have a problem at present that prevents me using the link you provided. I tried to add a static ip address in /etc/network/interfaces and 'ballsed' it up by making changes by following some idiot on youtube.

I should have made a copy of it before I started, but like an idiot I didn't bother. Now I can't do anything with the Pi.

I looked around for a default layout but wasn't sure if I had the right one or not. I'm using Kali Linux with an 'Alfa Card' attached which is giving me wlan1 instead of wlan0.

Do you think I should leave the Alfa card off and reset the network/interface back to its default state and then try to set up a static ip address from there.

Any help here would be gratefully recieved.

Thanks a lot

Mikey
2020-02-03, 10:30
Hi
I managed to take a snap shot of my Network interface and this is what it looks like at the moment

3826

It doesn't look too dissimilar from the on in rollercoaster's post but not quite the same.

I apologise for being a pain but if I make alterations I might make it worse than it already is.

Can someone look at it and tell me what needs changing.

Thanks a lot for your patients.

rollercoaster
2020-02-04, 08:30
The issue there seems to be that you mixed dhcp and static configurations. On the line that says

iface wlan1 inet dhcp
...

that means you are wanting your wlan1 to acquire an IP via DHCP and yet you added additional lines that are reserved for static assignment. So essentially, conflicting. If you want static IP addressing change that line to:

iface wlan1 inet static

and keep the rest of the lines below.

Mikey
2020-02-04, 09:23
Thanks rollercoaster

I'll do that.

So easy when you know what your doing isn't it.

Best wishes

rollercoaster
2020-02-04, 18:18
One issue that you might encounter though. The AP leases an IP via DHCP. There is no way for it to know that your statically-assigned IP is in use, hence it can be assigned to any one else. That can cause you lots of connection issues which might be hard to debug if you don't know to troubleshoot.

humility
2020-08-04, 13:19
pls i want to change mi IP who can help me out ?